Skip to content

Commit

Permalink
Database mutations test added (#2285)
Browse files Browse the repository at this point in the history
* Updated Code

* Updated Code
  • Loading branch information
imshivam-gupta authored Dec 30, 2023
1 parent 858c633 commit 97c1ee7
Show file tree
Hide file tree
Showing 3 changed files with 1,089 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/services/database_mutation_functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -393,10 +393,10 @@ class DataBaseMutationFunctions {
fetchOrgById(id);
}
} else if (result.data != null && result.isConcrete) {
print(result.data!['organizations']);
return OrgInfo.fromJson(
// ignore: collection_methods_unrelated_type
(result.data!['organizations'] as Map<String, dynamic>)[0]
as Map<String, dynamic>,
(result.data!['organizations'] as List<Map<String, dynamic>>)[0],
);
}
return false;
Expand Down
15 changes: 8 additions & 7 deletions test/helpers/test_helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,14 @@ GraphqlConfig getAndRegisterGraphqlConfig() {
});

when(service.authClient()).thenAnswer((realInvocation) {
final AuthLink authLink =
AuthLink(getToken: () async => 'Bearer ${GraphqlConfig.token}');
final Link finalAuthLink = authLink.concat(service.httpLink);
return GraphQLClient(
cache: GraphQLCache(partialDataPolicy: PartialDataCachePolicy.accept),
link: finalAuthLink,
);
// final AuthLink authLink =
// AuthLink(getToken: () async => 'Bearer ${GraphqlConfig.token}');
// final Link finalAuthLink = authLink.concat(service.httpLink);
// return GraphQLClient(
// cache: GraphQLCache(partialDataPolicy: PartialDataCachePolicy.accept),
// link: finalAuthLink,
// );
return locator<GraphQLClient>();
});

when(service.getToken()).thenAnswer((_) async => "sample_token");
Expand Down
Loading

0 comments on commit 97c1ee7

Please sign in to comment.