platform/test/common.dart
2017-07-03 11:37:35 -04:00

23 lines
No EOL
588 B
Dart

import 'package:graphql_parser/graphql_parser.dart';
import 'package:matcher/matcher.dart';
Parser parse(String text) => new Parser(scan(text));
Matcher equalsParsed(value) => new _EqualsParsed(value);
class _EqualsParsed extends Matcher {
final value;
_EqualsParsed(this.value);
@override
Description describe(Description description)
=> description.add('equals $value when parsed as a GraphQL value');
@override
bool matches(String item, Map matchState) {
var p = parse(item);
var v = p.parseValue();
return equals(value).matches(v.value, matchState);
}
}