@@ -67,7 +67,9 @@ describe('Validate: Scalar leafs', () => {
6767 // We can't leverage expectErrors since it doesn't support passing in the
6868 // documentNode directly. We have to do this because this is technically
6969 // an invalid document.
70- const errors = validate ( testSchema , doc , [ ScalarLeafsRule ] ) ;
70+ const errors = validate ( testSchema , doc , [ ScalarLeafsRule ] , {
71+ allowEmptySelectionSets : false ,
72+ } ) ;
7173 expectJSON ( errors ) . toDeepEqual ( [
7274 {
7375 message :
@@ -76,25 +78,17 @@ describe('Validate: Scalar leafs', () => {
7678 ] ) ;
7779 } ) ;
7880
79- it ( 'object type having no selections is allowed with experimentalEmptySelectionSets' , ( ) => {
80- const doc = parse ( '{ human { } }' , {
81- experimentalEmptySelectionSets : true ,
82- } ) ;
81+ it ( 'object type having no selections is allowed by default' , ( ) => {
82+ const doc = parse ( '{ human { } }' ) ;
8383
84- const errors = validate ( testSchema , doc , [ ScalarLeafsRule ] , {
85- experimentalEmptySelectionSets : true ,
86- } ) ;
84+ const errors = validate ( testSchema , doc , [ ScalarLeafsRule ] ) ;
8785 expectJSON ( errors ) . toDeepEqual ( [ ] ) ;
8886 } ) ;
8987
90- it ( 'scalar selection is still rejected with experimentalEmptySelectionSets' , ( ) => {
91- const doc = parse ( '{ human { name { } } }' , {
92- experimentalEmptySelectionSets : true ,
93- } ) ;
88+ it ( 'scalar selection is still rejected with allowEmptySelectionSets' , ( ) => {
89+ const doc = parse ( '{ human { name { } } }' ) ;
9490
95- const errors = validate ( testSchema , doc , [ ScalarLeafsRule ] , {
96- experimentalEmptySelectionSets : true ,
97- } ) ;
91+ const errors = validate ( testSchema , doc , [ ScalarLeafsRule ] ) ;
9892 expectJSON ( errors ) . toDeepEqual ( [
9993 {
10094 message :
@@ -195,37 +189,4 @@ describe('Validate: Scalar leafs', () => {
195189 } ,
196190 ] ) ;
197191 } ) ;
198-
199- it ( 'object type having only one selection' , ( ) => {
200- const doc : DocumentNode = {
201- kind : Kind . DOCUMENT ,
202- definitions : [
203- {
204- kind : Kind . OPERATION_DEFINITION ,
205- operation : OperationTypeNode . QUERY ,
206- selectionSet : {
207- kind : Kind . SELECTION_SET ,
208- selections : [
209- {
210- kind : Kind . FIELD ,
211- name : { kind : Kind . NAME , value : 'human' } ,
212- selectionSet : { kind : Kind . SELECTION_SET , selections : [ ] } ,
213- } ,
214- ] ,
215- } ,
216- } ,
217- ] ,
218- } ;
219-
220- // We can't leverage expectErrors since it doesn't support passing in the
221- // documentNode directly. We have to do this because this is technically
222- // an invalid document.
223- const errors = validate ( testSchema , doc , [ ScalarLeafsRule ] ) ;
224- expectJSON ( errors ) . toDeepEqual ( [
225- {
226- message :
227- 'Field "human" of type "Human" must have at least one field selected.' ,
228- } ,
229- ] ) ;
230- } ) ;
231192} ) ;
0 commit comments