Browse Source

Content directory & query node tests: fix getChannelbyTitle query

iorveth 4 years ago
parent
commit
a0c5ef9bb9

+ 5 - 5
tests/network-tests/src/Api.ts

@@ -2036,10 +2036,10 @@ export class QueryNodeApi extends Api {
     this.queryNodeProvider = queryNodeProvider
   }
 
-  public async getChannelbyTitle(channelTitle: string): Promise<ApolloQueryResult<any>> {
+  public async getChannelbyTitle(title: string): Promise<ApolloQueryResult<any>> {
     const GET_CHANNEL_BY_TITLE = gql`
-      query {
-        channels {
+    query($title: String!) {	
+        channels(where: {title_eq: $title} ) {
           title
           description
           coverPhotoUrl
@@ -2051,6 +2051,6 @@ export class QueryNodeApi extends Api {
       }
     `
 
-    return await this.queryNodeProvider.query({ query: GET_CHANNEL_BY_TITLE })
-  }
+    return await this.queryNodeProvider.query({ query: GET_CHANNEL_BY_TITLE, variables: {title} })
+    }
 }

+ 6 - 6
tests/network-tests/src/flows/contentDirectory/creatingChannel.ts

@@ -32,11 +32,11 @@ export default async function channelCreation(api: QueryNodeApi, pair: KeyringPa
   await delay(120000)
 
   const result = await api.getChannelbyTitle(createChannelHappyCaseFixture.channelEntity.title)
-  console.log(result.data)
+  const queriedChannel = result.data.channels[0]
 
-  // assert(data.title === createChannelHappyCaseFixture.channelEntity.title, 'Should be equal')
-  // assert(data.description === createChannelHappyCaseFixture.channelEntity.description, 'Should be equal')
-  // assert(data.coverPhotoUrl === createChannelHappyCaseFixture.channelEntity.coverPhotoUrl, 'Should be equal')
-  // assert(data.avatarPhotoUrl === createChannelHappyCaseFixture.channelEntity.avatarPhotoURL, 'Should be equal')
-  // assert(data.isPublic === createChannelHappyCaseFixture.channelEntity.isPublic.toString(), 'Should be equal')
+  assert(queriedChannel.title === createChannelHappyCaseFixture.channelEntity.title, 'Should be equal')
+  assert(queriedChannel.description === createChannelHappyCaseFixture.channelEntity.description, 'Should be equal')
+  assert(queriedChannel.coverPhotoUrl === createChannelHappyCaseFixture.channelEntity.coverPhotoUrl, 'Should be equal')
+  assert(queriedChannel.avatarPhotoUrl === createChannelHappyCaseFixture.channelEntity.avatarPhotoURL, 'Should be equal')
+  assert(queriedChannel.isPublic === createChannelHappyCaseFixture.channelEntity.isPublic, 'Should be equal')
 }