diff --git a/packages/graphql/test/anonymous_operations_test.dart b/packages/graphql/test/anonymous_operations_test.dart index 2d4c2b4d7..ea65d3e36 100644 --- a/packages/graphql/test/anonymous_operations_test.dart +++ b/packages/graphql/test/anonymous_operations_test.dart @@ -1,3 +1,4 @@ +import 'package:gql/language.dart'; import 'package:test/test.dart'; import 'package:mockito/mockito.dart'; import 'package:http/http.dart' as http; @@ -58,7 +59,7 @@ void main() { group('query', () { test('successful query', () async { final WatchQueryOptions _options = WatchQueryOptions( - document: readRepositories, + documentNode: parseString(readRepositories), variables: {}, ); when( @@ -135,7 +136,8 @@ void main() { }); group('mutation', () { test('successful mutation', () async { - final MutationOptions _options = MutationOptions(document: addStar); + final MutationOptions _options = + MutationOptions(documentNode: parseString(addStar)); when(mockHttpClient.send(any)).thenAnswer((Invocation a) async => simpleResponse( body: diff --git a/packages/graphql/test/core/raw_operation_data_test.dart b/packages/graphql/test/core/raw_operation_data_test.dart index f0eba904d..05c189ca2 100644 --- a/packages/graphql/test/core/raw_operation_data_test.dart +++ b/packages/graphql/test/core/raw_operation_data_test.dart @@ -1,3 +1,4 @@ +import 'package:gql/language.dart'; import 'package:graphql/src/core/raw_operation_data.dart'; import 'package:test/test.dart'; @@ -6,7 +7,7 @@ void main() { group('single operation', () { test('query without name', () { final opData = RawOperationData( - document: 'query {}', + documentNode: parseString('query {}'), ); expect(opData.operationName, null); @@ -14,7 +15,7 @@ void main() { test('query with explicit name', () { final opData = RawOperationData( - document: 'query Operation {}', + documentNode: parseString('query Operation {}'), operationName: 'Operation', ); @@ -23,7 +24,7 @@ void main() { test('mutation with explicit name', () { final opData = RawOperationData( - document: 'mutation Operation {}', + documentNode: parseString('mutation Operation {}'), operationName: 'Operation', ); @@ -32,7 +33,7 @@ void main() { test('subscription with explicit name', () { final opData = RawOperationData( - document: 'subscription Operation {}', + documentNode: parseString('subscription Operation {}'), operationName: 'Operation', ); @@ -41,7 +42,7 @@ void main() { test('query with implicit name', () { final opData = RawOperationData( - document: 'query Operation {}', + documentNode: parseString('query Operation {}'), ); expect(opData.operationName, 'Operation'); @@ -49,7 +50,7 @@ void main() { test('mutation with implicit name', () { final opData = RawOperationData( - document: 'mutation Operation {}', + documentNode: parseString('mutation Operation {}'), ); expect(opData.operationName, 'Operation'); @@ -57,7 +58,7 @@ void main() { test('subscription with implicit name', () { final opData = RawOperationData( - document: 'subscription Operation {}', + documentNode: parseString('subscription Operation {}'), ); expect(opData.operationName, 'Operation'); @@ -73,7 +74,7 @@ void main() { test('query with explicit name', () { final opData = RawOperationData( - document: document, + documentNode: parseString(document), operationName: 'OperationQ', ); @@ -82,7 +83,7 @@ void main() { test('mutation with explicit name', () { final opData = RawOperationData( - document: document, + documentNode: parseString(document), operationName: 'OperationM', ); @@ -91,7 +92,7 @@ void main() { test('subscription with explicit name', () { final opData = RawOperationData( - document: document, + documentNode: parseString(document), operationName: 'OperationS', ); @@ -100,7 +101,7 @@ void main() { test('query with implicit name', () { final opData = RawOperationData( - document: document, + documentNode: parseString(document), ); expect(opData.operationName, 'OperationS'); @@ -108,7 +109,7 @@ void main() { test('mutation with implicit name', () { final opData = RawOperationData( - document: document, + documentNode: parseString(document), ); expect(opData.operationName, 'OperationS'); @@ -116,7 +117,7 @@ void main() { test('subscription with implicit name', () { final opData = RawOperationData( - document: document, + documentNode: parseString(document), ); expect(opData.operationName, 'OperationS'); diff --git a/packages/graphql/test/graphql_client_test.dart b/packages/graphql/test/graphql_client_test.dart index ab0730049..19d67f1f2 100644 --- a/packages/graphql/test/graphql_client_test.dart +++ b/packages/graphql/test/graphql_client_test.dart @@ -3,6 +3,7 @@ import 'package:mockito/mockito.dart'; import 'package:http/http.dart' as http; import 'package:graphql/client.dart'; +import 'package:gql/language.dart'; import './helpers.dart'; @@ -60,7 +61,7 @@ void main() { group('query', () { test('successful query', () async { final WatchQueryOptions _options = WatchQueryOptions( - document: readRepositories, + documentNode: parseString(readRepositories), variables: { 'nRepositories': 42, }, @@ -135,8 +136,8 @@ void main() { throw e; }); - final QueryResult r = await graphQLClientClient - .query(WatchQueryOptions(document: readRepositories)); + final QueryResult r = await graphQLClientClient.query( + WatchQueryOptions(documentNode: parseString(readRepositories))); expect((r.exception.clientException as UnhandledFailureWrapper).failure, e); @@ -151,8 +152,8 @@ void main() { throw e; }); - final QueryResult r = await graphQLClientClient - .query(WatchQueryOptions(document: readRepositories)); + final QueryResult r = await graphQLClientClient.query( + WatchQueryOptions(documentNode: parseString(readRepositories))); expect( (r.exception.clientException as UnhandledFailureWrapper).failure, @@ -171,7 +172,8 @@ void main() { }); group('mutation', () { test('successful mutation', () async { - final MutationOptions _options = MutationOptions(document: addStar); + final MutationOptions _options = + MutationOptions(documentNode: parseString(addStar)); when(mockHttpClient.send(any)).thenAnswer((Invocation a) async => simpleResponse( body: diff --git a/packages/graphql/test/link/error/link_error_test.dart b/packages/graphql/test/link/error/link_error_test.dart index 16f6796e6..bcf56b35e 100644 --- a/packages/graphql/test/link/error/link_error_test.dart +++ b/packages/graphql/test/link/error/link_error_test.dart @@ -1,6 +1,7 @@ import "dart:async"; import "dart:convert"; +import 'package:gql/language.dart'; import 'package:graphql/src/exceptions/exceptions.dart'; import 'package:graphql/src/link/error/link_error.dart'; import 'package:graphql/src/link/http/link_http.dart'; @@ -21,7 +22,7 @@ void main() { setUp(() { client = MockClient(); query = Operation( - document: 'query Operation {}', + documentNode: parseString('query Operation {}'), operationName: 'Operation', ); httpLink = HttpLink( diff --git a/packages/graphql/test/link/http/link_http_test.dart b/packages/graphql/test/link/http/link_http_test.dart index c9b0ed122..5bb5f6377 100644 --- a/packages/graphql/test/link/http/link_http_test.dart +++ b/packages/graphql/test/link/http/link_http_test.dart @@ -1,6 +1,7 @@ import "dart:async"; import "dart:convert"; +import 'package:gql/language.dart'; import 'package:graphql/client.dart'; import 'package:graphql/internal.dart'; import 'package:graphql/src/link/http/link_http.dart'; @@ -23,11 +24,11 @@ void main() { setUp(() { client = MockClient(); query = Operation( - document: 'query Operation {}', + documentNode: parseString('query Operation {}'), operationName: 'Operation', ); subscription = Operation( - document: 'subscription Operation {}', + documentNode: parseString('subscription Operation {}'), operationName: 'Operation', ); link = HttpLink( @@ -234,7 +235,7 @@ void main() { ); final query = Operation( - document: '{}', + documentNode: parseString('{}'), extensions: {'extension-1': 'extension-value-1'}, ); query.setContext({ @@ -476,7 +477,7 @@ void main() { ); final query = Operation( - document: '{}', + documentNode: parseString('{}'), variables: { 'files': [ http.MultipartFile.fromString( diff --git a/packages/graphql/test/multipart_upload_io_test.dart b/packages/graphql/test/multipart_upload_io_test.dart index 21ebbfc0d..de2e56d79 100644 --- a/packages/graphql/test/multipart_upload_io_test.dart +++ b/packages/graphql/test/multipart_upload_io_test.dart @@ -1,5 +1,5 @@ +import 'package:gql/language.dart'; @TestOn("vm") - import 'package:test/test.dart'; import 'package:mockito/mockito.dart'; import 'package:http/http.dart' as http; @@ -58,7 +58,7 @@ void main() { 'upload with io.File instance deprecation warning', overridePrint((log) async { final MutationOptions _options = MutationOptions( - document: uploadMutation, + documentNode: parseString(uploadMutation), variables: { 'files': [ io.File('pubspec.yaml'), diff --git a/packages/graphql/test/multipart_upload_test.dart b/packages/graphql/test/multipart_upload_test.dart index 5c16d3f00..9212a5e84 100644 --- a/packages/graphql/test/multipart_upload_test.dart +++ b/packages/graphql/test/multipart_upload_test.dart @@ -1,3 +1,4 @@ +import 'package:gql/language.dart'; import 'package:http_parser/http_parser.dart'; import 'package:test/test.dart'; import 'package:mockito/mockito.dart'; @@ -124,7 +125,7 @@ void main() { }); final MutationOptions _options = MutationOptions( - document: uploadMutation, + documentNode: parseString(uploadMutation), variables: { 'files': [ http.MultipartFile.fromBytes( diff --git a/packages/graphql/test/socket_client_test.dart b/packages/graphql/test/socket_client_test.dart index f5c14eb0a..116a99aab 100644 --- a/packages/graphql/test/socket_client_test.dart +++ b/packages/graphql/test/socket_client_test.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'dart:typed_data'; +import 'package:gql/language.dart'; import 'package:graphql/src/link/operation.dart'; import 'package:graphql/src/websocket/messages.dart'; import 'package:test/test.dart'; @@ -36,7 +37,7 @@ void main() { }); test('subscription data', () async { final payload = SubscriptionRequest( - Operation(document: 'subscription {}'), + Operation(documentNode: parseString('subscription {}')), ); final waitForConnection = true; final subscriptionDataStream = diff --git a/packages/graphql/test/websocket_legacy_io_test.dart b/packages/graphql/test/websocket_legacy_io_test.dart index 3908d625a..c44317bcc 100644 --- a/packages/graphql/test/websocket_legacy_io_test.dart +++ b/packages/graphql/test/websocket_legacy_io_test.dart @@ -3,6 +3,7 @@ import 'dart:convert'; import 'dart:typed_data'; +import 'package:gql/language.dart'; import 'package:test/test.dart'; import 'package:graphql/src/link/operation.dart'; @@ -43,7 +44,7 @@ void main() { }); test('subscription data', () async { final payload = SubscriptionRequest( - Operation(document: 'subscription {}'), + Operation(documentNode: parseString('subscription {}')), ); final waitForConnection = true; final subscriptionDataStream =