platform/graphql_parser/test/next_name_test.dart

25 lines
746 B
Dart
Raw Normal View History

2019-03-31 20:21:11 +00:00
import 'package:test/test.dart';
import 'common.dart';
var githubSrc = r'''
query searchRepos($queryString: String!, $repositoryOrder: RepositoryOrder, $first: Int!) {
search(type: REPOSITORY, query: $queryString, first: $first) {
...SearchResultItemConnection
}
}
''';
void main() {
test('can parse formerly-reserved words', () {
var def = parse(githubSrc).parseOperationDefinition();
expect(def.isQuery, isTrue);
2019-03-31 20:31:58 +00:00
expect(def.variableDefinitions.variableDefinitions, hasLength(3));
var searchField = def.selectionSet.selections[0].field;
expect(searchField.fieldName.name, 'search');
var argNames = searchField.arguments.map((a) => a.name).toList();
expect(argNames, ['type', 'query', 'first']);
2019-03-31 20:21:11 +00:00
});
}