@@ -31,116 +31,133 @@ describe('resolveSchemaCoordinate', () => {
31
31
` ) ;
32
32
33
33
it ( 'resolves a Named Type' , ( ) => {
34
- const expected = schema . getType ( 'Business' ) ;
35
- expect ( expected ) . not . to . equal ( undefined ) ;
36
- expect ( resolveSchemaCoordinate ( schema , 'Business' ) ) . to . equal ( expected ) ;
34
+ expect ( resolveSchemaCoordinate ( schema , 'Business' ) ) . to . deep . equal ( {
35
+ kind : 'NamedType' ,
36
+ namedType : schema . getType ( 'Business' ) ,
37
+ } ) ;
37
38
38
- expect ( resolveSchemaCoordinate ( schema , 'String' ) ) . to . equal (
39
- schema . getType ( 'String' ) ,
40
- ) ;
39
+ expect ( resolveSchemaCoordinate ( schema , 'String' ) ) . to . deep . equal ( {
40
+ kind : 'NamedType' ,
41
+ namedType : schema . getType ( 'String' ) ,
42
+ } ) ;
41
43
42
- expect ( resolveSchemaCoordinate ( schema , 'private' ) ) . to . equal ( undefined ) ;
44
+ expect ( resolveSchemaCoordinate ( schema , 'private' ) ) . to . deep . equal ( undefined ) ;
43
45
44
- expect ( resolveSchemaCoordinate ( schema , 'Unknown' ) ) . to . equal ( undefined ) ;
46
+ expect ( resolveSchemaCoordinate ( schema , 'Unknown' ) ) . to . deep . equal ( undefined ) ;
45
47
} ) ;
46
48
47
49
it ( 'resolves a Type Field' , ( ) => {
48
- const expected = schema . getType ( 'Business' ) . getFields ( ) . name ;
49
- expect ( expected ) . not . to . equal ( undefined ) ;
50
- expect ( resolveSchemaCoordinate ( schema , 'Business.name' ) ) . to . equal ( expected ) ;
50
+ expect ( resolveSchemaCoordinate ( schema , 'Business.name' ) ) . to . deep . equal ( {
51
+ kind : 'Field' ,
52
+ field : schema . getType ( 'Business' ) . getFields ( ) . name ,
53
+ } ) ;
51
54
52
- expect ( resolveSchemaCoordinate ( schema , 'Business.unknown' ) ) . to . equal (
55
+ expect ( resolveSchemaCoordinate ( schema , 'Business.unknown' ) ) . to . deep . equal (
53
56
undefined ,
54
57
) ;
55
58
56
- expect ( resolveSchemaCoordinate ( schema , 'Unknown.field' ) ) . to . equal (
59
+ expect ( resolveSchemaCoordinate ( schema , 'Unknown.field' ) ) . to . deep . equal (
57
60
undefined ,
58
61
) ;
59
62
60
- expect ( resolveSchemaCoordinate ( schema , 'String.field' ) ) . to . equal ( undefined ) ;
63
+ expect ( resolveSchemaCoordinate ( schema , 'String.field' ) ) . to . deep . equal (
64
+ undefined ,
65
+ ) ;
61
66
} ) ;
62
67
63
68
it ( 'does not resolve meta-fields' , ( ) => {
64
- expect ( resolveSchemaCoordinate ( schema , 'Business.__typename' ) ) . to . equal (
65
- undefined ,
66
- ) ;
69
+ expect (
70
+ resolveSchemaCoordinate ( schema , 'Business.__typename' ) ,
71
+ ) . to . deep . equal ( undefined ) ;
67
72
} ) ;
68
73
69
74
it ( 'resolves a Input Field' , ( ) => {
70
- const expected = schema . getType ( 'SearchCriteria' ) . getFields ( ) . filter ;
71
- expect ( expected ) . not . to . equal ( undefined ) ;
72
- expect ( resolveSchemaCoordinate ( schema , 'SearchCriteria.filter' ) ) . to . equal (
73
- expected ,
74
- ) ;
75
+ expect (
76
+ resolveSchemaCoordinate ( schema , 'SearchCriteria.filter' ) ,
77
+ ) . to . deep . equal ( {
78
+ kind : 'InputField' ,
79
+ inputField : schema . getType ( 'SearchCriteria' ) . getFields ( ) . filter ,
80
+ } ) ;
75
81
76
- expect ( resolveSchemaCoordinate ( schema , 'SearchCriteria.unknown' ) ) . to . equal (
77
- undefined ,
78
- ) ;
82
+ expect (
83
+ resolveSchemaCoordinate ( schema , 'SearchCriteria.unknown' ) ,
84
+ ) . to . deep . equal ( undefined ) ;
79
85
} ) ;
80
86
81
87
it ( 'resolves a Enum Value' , ( ) => {
82
- const expected = schema . getType ( 'SearchFilter' ) . getValue ( 'OPEN_NOW' ) ;
83
- expect ( expected ) . not . to . equal ( undefined ) ;
84
- expect ( resolveSchemaCoordinate ( schema , 'SearchFilter.OPEN_NOW' ) ) . to . equal (
85
- expected ,
86
- ) ;
88
+ expect (
89
+ resolveSchemaCoordinate ( schema , 'SearchFilter.OPEN_NOW' ) ,
90
+ ) . to . deep . equal ( {
91
+ kind : 'EnumValue' ,
92
+ enumValue : schema . getType ( 'SearchFilter' ) . getValue ( 'OPEN_NOW' ) ,
93
+ } ) ;
87
94
88
- expect ( resolveSchemaCoordinate ( schema , 'SearchFilter.UNKNOWN' ) ) . to . equal (
89
- undefined ,
90
- ) ;
95
+ expect (
96
+ resolveSchemaCoordinate ( schema , 'SearchFilter.UNKNOWN' ) ,
97
+ ) . to . deep . equal ( undefined ) ;
91
98
} ) ;
92
99
93
100
it ( 'resolves a Field Argument' , ( ) => {
94
- const expected = schema
95
- . getType ( 'Query' )
96
- . getFields ( )
97
- . searchBusiness . args . find ( ( arg ) => arg . name === 'criteria' ) ;
98
- expect ( expected ) . not . to . equal ( undefined ) ;
99
101
expect (
100
102
resolveSchemaCoordinate ( schema , 'Query.searchBusiness(criteria:)' ) ,
101
- ) . to . equal ( expected ) ;
103
+ ) . to . deep . equal ( {
104
+ kind : 'FieldArgument' ,
105
+ fieldArgument : schema
106
+ . getType ( 'Query' )
107
+ . getFields ( )
108
+ . searchBusiness . args . find ( ( arg ) => arg . name === 'criteria' ) ,
109
+ } ) ;
102
110
103
- expect ( resolveSchemaCoordinate ( schema , 'Business.name(unknown:)' ) ) . to . equal (
104
- undefined ,
105
- ) ;
111
+ expect (
112
+ resolveSchemaCoordinate ( schema , 'Business.name(unknown:)' ) ,
113
+ ) . to . deep . equal ( undefined ) ;
106
114
107
- expect ( resolveSchemaCoordinate ( schema , 'Unknown.field(arg:)' ) ) . to . equal (
108
- undefined ,
109
- ) ;
115
+ expect (
116
+ resolveSchemaCoordinate ( schema , 'Unknown.field(arg:)' ) ,
117
+ ) . to . deep . equal ( undefined ) ;
110
118
111
- expect ( resolveSchemaCoordinate ( schema , 'Business.unknown(arg:)' ) ) . to . equal (
112
- undefined ,
113
- ) ;
119
+ expect (
120
+ resolveSchemaCoordinate ( schema , 'Business.unknown(arg:)' ) ,
121
+ ) . to . deep . equal ( undefined ) ;
114
122
115
123
expect (
116
124
resolveSchemaCoordinate ( schema , 'SearchCriteria.name(arg:)' ) ,
117
- ) . to . equal ( undefined ) ;
125
+ ) . to . deep . equal ( undefined ) ;
118
126
} ) ;
119
127
120
128
it ( 'resolves a Directive' , ( ) => {
121
- const expected = schema . getDirective ( 'private' ) ;
122
- expect ( expected ) . not . to . equal ( undefined ) ;
123
- expect ( resolveSchemaCoordinate ( schema , '@private' ) ) . to . equal ( expected ) ;
129
+ expect ( resolveSchemaCoordinate ( schema , '@private' ) ) . to . deep . equal ( {
130
+ kind : 'Directive' ,
131
+ directive : schema . getDirective ( 'private' ) ,
132
+ } ) ;
124
133
125
- expect ( resolveSchemaCoordinate ( schema , '@unknown' ) ) . to . equal ( undefined ) ;
134
+ expect ( resolveSchemaCoordinate ( schema , '@deprecated' ) ) . to . deep . equal ( {
135
+ kind : 'Directive' ,
136
+ directive : schema . getDirective ( 'deprecated' ) ,
137
+ } ) ;
126
138
127
- expect ( resolveSchemaCoordinate ( schema , '@Business' ) ) . to . equal ( undefined ) ;
128
- } ) ;
139
+ expect ( resolveSchemaCoordinate ( schema , '@unknown' ) ) . to . deep . equal (
140
+ undefined ,
141
+ ) ;
129
142
130
- it ( 'resolves a Directive Argument' , ( ) => {
131
- const expected = schema
132
- . getDirective ( 'private' )
133
- . args . find ( ( arg ) => arg . name === 'scope' ) ;
134
- expect ( expected ) . not . to . equal ( undefined ) ;
135
- expect ( resolveSchemaCoordinate ( schema , '@private(scope:)' ) ) . to . equal (
136
- expected ,
143
+ expect ( resolveSchemaCoordinate ( schema , '@Business' ) ) . to . deep . equal (
144
+ undefined ,
137
145
) ;
146
+ } ) ;
138
147
139
- expect ( resolveSchemaCoordinate ( schema , '@private(unknown:)' ) ) . to . equal (
148
+ it ( 'resolves a Directive Argument' , ( ) => {
149
+ expect ( resolveSchemaCoordinate ( schema , '@private(scope:)' ) ) . to . deep . equal ( {
150
+ kind : 'DirectiveArgument' ,
151
+ directiveArgument : schema
152
+ . getDirective ( 'private' )
153
+ . args . find ( ( arg ) => arg . name === 'scope' ) ,
154
+ } ) ;
155
+
156
+ expect ( resolveSchemaCoordinate ( schema , '@private(unknown:)' ) ) . to . deep . equal (
140
157
undefined ,
141
158
) ;
142
159
143
- expect ( resolveSchemaCoordinate ( schema , '@unknown(arg:)' ) ) . to . equal (
160
+ expect ( resolveSchemaCoordinate ( schema , '@unknown(arg:)' ) ) . to . deep . equal (
144
161
undefined ,
145
162
) ;
146
163
} ) ;
0 commit comments