Skip to content

Commit

Permalink
Add: GraphQl Test (PalisadoesFoundation#2298)
Browse files Browse the repository at this point in the history
  • Loading branch information
AyushRaghuvanshi authored and Peter Harrison committed Jan 10, 2024
1 parent cefcb0e commit 86c8386
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/service_tests/graphql_config_test.dart
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,
);
});
});
}

0 comments on commit 86c8386

Please sign in to comment.