@@ -28,9 +28,45 @@ it('has defaults', () => {
2828} )
2929
3030describe ( 'connctions' , ( ) => {
31- it ( 'can be changed, preserving the core defaults ' , ( ) => {
31+ it ( 'can be set empty, doing nothing ' , ( ) => {
3232 const original = cloneDeep ( sm . data )
3333 sm . change ( { connections : { } } )
3434 expect ( sm . data ) . toEqual ( original )
3535 } )
36+ it ( 'new types can be added getting the core settings' , ( ) => {
37+ sm . change ( { connections : { a : { } } } )
38+ expect ( sm . data . connections ) . toMatchInlineSnapshot ( `
39+ Object {
40+ "a": Object {
41+ "nexusFieldName": "connection",
42+ "nexusSchemaImportId": "nexus/components/schema",
43+ },
44+ "default": Object {
45+ "nexusFieldName": "connection",
46+ "nexusSchemaImportId": "nexus/components/schema",
47+ },
48+ }
49+ ` )
50+ } )
51+ it ( 'existing custom types can be changed, preserving its core settings' , ( ) => {
52+ sm . change ( { connections : { a : { } } } ) // test above says this has the core settings
53+ sm . change ( { connections : { a : { disableForwardPagination : true } } } )
54+ expect ( sm . data . connections . a ) . toMatchInlineSnapshot ( `
55+ Object {
56+ "disableForwardPagination": true,
57+ "nexusFieldName": "connection",
58+ "nexusSchemaImportId": "nexus/components/schema",
59+ }
60+ ` )
61+ } )
62+ it ( 'default types can be changed, preserving its core settings' , ( ) => {
63+ sm . change ( { connections : { default : { disableForwardPagination : true } } } )
64+ expect ( sm . data . connections . default ) . toMatchInlineSnapshot ( `
65+ Object {
66+ "disableForwardPagination": true,
67+ "nexusFieldName": "connection",
68+ "nexusSchemaImportId": "nexus/components/schema",
69+ }
70+ ` )
71+ } )
3672} )
0 commit comments