@@ -26,54 +26,55 @@ function filterNodes(predicate: (node: ASTNode) => boolean): Array<string> {
26
26
27
27
describe ( 'AST node predicates' , ( ) => {
28
28
it ( 'isDefinitionNode' , ( ) => {
29
- expect ( filterNodes ( isDefinitionNode ) ) . to . deep . equal ( [
30
- 'OperationDefinition' ,
31
- 'FragmentDefinition' ,
32
- 'SchemaDefinition' ,
33
- 'ScalarTypeDefinition' ,
34
- 'ObjectTypeDefinition' ,
35
- 'InterfaceTypeDefinition' ,
36
- 'UnionTypeDefinition' ,
37
- 'EnumTypeDefinition' ,
38
- 'InputObjectTypeDefinition' ,
39
- 'DirectiveDefinition' ,
40
- 'SchemaExtension' ,
41
- 'ScalarTypeExtension' ,
42
- 'ObjectTypeExtension' ,
43
- 'InterfaceTypeExtension' ,
44
- 'UnionTypeExtension' ,
45
- 'EnumTypeExtension' ,
46
- 'InputObjectTypeExtension' ,
47
- ] ) ;
29
+ expect ( filterNodes ( isDefinitionNode ) ) . to . deep . equal (
30
+ [
31
+ 'OperationDefinition' ,
32
+ 'FragmentDefinition' ,
33
+ 'SchemaDefinition' ,
34
+ 'ScalarTypeDefinition' ,
35
+ 'ObjectTypeDefinition' ,
36
+ 'InterfaceTypeDefinition' ,
37
+ 'UnionTypeDefinition' ,
38
+ 'EnumTypeDefinition' ,
39
+ 'InputObjectTypeDefinition' ,
40
+ 'DirectiveDefinition' ,
41
+ 'SchemaExtension' ,
42
+ 'ScalarTypeExtension' ,
43
+ 'ObjectTypeExtension' ,
44
+ 'InterfaceTypeExtension' ,
45
+ 'UnionTypeExtension' ,
46
+ 'EnumTypeExtension' ,
47
+ 'InputObjectTypeExtension' ,
48
+ ] . sort ( ) ,
49
+ ) ;
48
50
} ) ;
49
51
50
52
it ( 'isExecutableDefinitionNode' , ( ) => {
51
- expect ( filterNodes ( isExecutableDefinitionNode ) ) . to . deep . equal ( [
52
- 'OperationDefinition' ,
53
- 'FragmentDefinition' ,
54
- ] ) ;
53
+ expect ( filterNodes ( isExecutableDefinitionNode ) ) . to . deep . equal (
54
+ [ 'OperationDefinition' , 'FragmentDefinition' ] . sort ( ) ,
55
+ ) ;
55
56
} ) ;
56
57
57
58
it ( 'isSelectionNode' , ( ) => {
58
- expect ( filterNodes ( isSelectionNode ) ) . to . deep . equal ( [
59
- 'Field' ,
60
- 'FragmentSpread' ,
61
- 'InlineFragment' ,
62
- ] ) ;
59
+ expect ( filterNodes ( isSelectionNode ) ) . to . deep . equal (
60
+ [ 'Field' , 'FragmentSpread' , 'InlineFragment' ] . sort ( ) ,
61
+ ) ;
63
62
} ) ;
64
63
65
64
it ( 'isValueNode' , ( ) => {
66
- expect ( filterNodes ( isValueNode ) ) . to . deep . equal ( [
67
- 'Variable' ,
68
- 'IntValue' ,
69
- 'FloatValue' ,
70
- 'StringValue' ,
71
- 'BooleanValue' ,
72
- 'NullValue' ,
73
- 'EnumValue' ,
74
- 'ListValue' ,
75
- 'ObjectValue' ,
76
- ] ) ;
65
+ expect ( filterNodes ( isValueNode ) ) . to . deep . equal (
66
+ [
67
+ 'Variable' ,
68
+ 'IntValue' ,
69
+ 'FloatValue' ,
70
+ 'StringValue' ,
71
+ 'BooleanValue' ,
72
+ 'NullValue' ,
73
+ 'EnumValue' ,
74
+ 'ListValue' ,
75
+ 'ObjectValue' ,
76
+ ] . sort ( ) ,
77
+ ) ;
77
78
} ) ;
78
79
79
80
it ( 'isConstValueNode' , ( ) => {
@@ -88,57 +89,63 @@ describe('AST node predicates', () => {
88
89
} ) ;
89
90
90
91
it ( 'isTypeNode' , ( ) => {
91
- expect ( filterNodes ( isTypeNode ) ) . to . deep . equal ( [
92
- 'NamedType' ,
93
- 'ListType' ,
94
- 'NonNullType' ,
95
- ] ) ;
92
+ expect ( filterNodes ( isTypeNode ) ) . to . deep . equal (
93
+ [ 'NamedType' , 'ListType' , 'NonNullType' ] . sort ( ) ,
94
+ ) ;
96
95
} ) ;
97
96
98
97
it ( 'isTypeSystemDefinitionNode' , ( ) => {
99
- expect ( filterNodes ( isTypeSystemDefinitionNode ) ) . to . deep . equal ( [
100
- 'SchemaDefinition' ,
101
- 'ScalarTypeDefinition' ,
102
- 'ObjectTypeDefinition' ,
103
- 'InterfaceTypeDefinition' ,
104
- 'UnionTypeDefinition' ,
105
- 'EnumTypeDefinition' ,
106
- 'InputObjectTypeDefinition' ,
107
- 'DirectiveDefinition' ,
108
- ] ) ;
98
+ expect ( filterNodes ( isTypeSystemDefinitionNode ) ) . to . deep . equal (
99
+ [
100
+ 'SchemaDefinition' ,
101
+ 'ScalarTypeDefinition' ,
102
+ 'ObjectTypeDefinition' ,
103
+ 'InterfaceTypeDefinition' ,
104
+ 'UnionTypeDefinition' ,
105
+ 'EnumTypeDefinition' ,
106
+ 'InputObjectTypeDefinition' ,
107
+ 'DirectiveDefinition' ,
108
+ ] . sort ( ) ,
109
+ ) ;
109
110
} ) ;
110
111
111
112
it ( 'isTypeDefinitionNode' , ( ) => {
112
- expect ( filterNodes ( isTypeDefinitionNode ) ) . to . deep . equal ( [
113
- 'ScalarTypeDefinition' ,
114
- 'ObjectTypeDefinition' ,
115
- 'InterfaceTypeDefinition' ,
116
- 'UnionTypeDefinition' ,
117
- 'EnumTypeDefinition' ,
118
- 'InputObjectTypeDefinition' ,
119
- ] ) ;
113
+ expect ( filterNodes ( isTypeDefinitionNode ) ) . to . deep . equal (
114
+ [
115
+ 'ScalarTypeDefinition' ,
116
+ 'ObjectTypeDefinition' ,
117
+ 'InterfaceTypeDefinition' ,
118
+ 'UnionTypeDefinition' ,
119
+ 'EnumTypeDefinition' ,
120
+ 'InputObjectTypeDefinition' ,
121
+ ] . sort ( ) ,
122
+ ) ;
120
123
} ) ;
121
124
122
125
it ( 'isTypeSystemExtensionNode' , ( ) => {
123
- expect ( filterNodes ( isTypeSystemExtensionNode ) ) . to . deep . equal ( [
124
- 'SchemaExtension' ,
125
- 'ScalarTypeExtension' ,
126
- 'ObjectTypeExtension' ,
127
- 'InterfaceTypeExtension' ,
128
- 'UnionTypeExtension' ,
129
- 'EnumTypeExtension' ,
130
- 'InputObjectTypeExtension' ,
131
- ] ) ;
126
+ expect ( filterNodes ( isTypeSystemExtensionNode ) ) . to . deep . equal (
127
+ [
128
+ 'SchemaExtension' ,
129
+ 'ScalarTypeExtension' ,
130
+ 'ObjectTypeExtension' ,
131
+ 'InterfaceTypeExtension' ,
132
+ 'UnionTypeExtension' ,
133
+ 'EnumTypeExtension' ,
134
+ 'InputObjectTypeExtension' ,
135
+ ] . sort ( ) ,
136
+ ) ;
132
137
} ) ;
133
138
134
139
it ( 'isTypeExtensionNode' , ( ) => {
135
- expect ( filterNodes ( isTypeExtensionNode ) ) . to . deep . equal ( [
136
- 'ScalarTypeExtension' ,
137
- 'ObjectTypeExtension' ,
138
- 'InterfaceTypeExtension' ,
139
- 'UnionTypeExtension' ,
140
- 'EnumTypeExtension' ,
141
- 'InputObjectTypeExtension' ,
142
- ] ) ;
140
+ expect ( filterNodes ( isTypeExtensionNode ) ) . to . deep . equal (
141
+ [
142
+ 'ScalarTypeExtension' ,
143
+ 'ObjectTypeExtension' ,
144
+ 'InterfaceTypeExtension' ,
145
+ 'UnionTypeExtension' ,
146
+ 'EnumTypeExtension' ,
147
+ 'InputObjectTypeExtension' ,
148
+ ] . sort ( ) ,
149
+ ) ;
143
150
} ) ;
144
151
} ) ;
0 commit comments