forked from PalisadoesFoundation/talawa
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add: GraphQl Test (PalisadoesFoundation#2298)
- Loading branch information
1 parent
cefcb0e
commit 86c8386
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:graphql_flutter/graphql_flutter.dart'; | ||
import 'package:talawa/services/graphql_config.dart'; | ||
import '../helpers/test_helpers.dart'; | ||
import '../helpers/test_locator.dart'; | ||
|
||
void main() { | ||
testSetupLocator(); | ||
|
||
setUp(() { | ||
registerServices(); | ||
}); | ||
group('Testing Graphql Config', () { | ||
test('test httpLink with MockHttpClient', () async { | ||
final graphqlConfig = GraphqlConfig(); | ||
final mockHttpClient = MockHttpClient(); | ||
final mockUri = Uri.parse('https://example.com/graphql'); | ||
|
||
graphqlConfig.httpLink = HttpLink( | ||
mockUri.toString(), | ||
httpClient: mockHttpClient, | ||
); | ||
|
||
final response = await graphqlConfig | ||
.clientToQuery() | ||
.query(QueryOptions(document: gql('query {}'))); | ||
expect( | ||
response.data, | ||
isNull, | ||
); | ||
}); | ||
}); | ||
} |