File tree Expand file tree Collapse file tree 1 file changed +52
-0
lines changed
Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change @@ -112,6 +112,58 @@ describe('mapSchemaConfig', () => {
112112 ) ;
113113 } ) ;
114114
115+ it ( 'can map fields with non-null return type' , ( ) => {
116+ const sdl = `
117+ type SomeType {
118+ field: String!
119+ }
120+ ` ;
121+
122+ const schemaConfig = buildSchema ( sdl ) . toConfig ( ) ;
123+
124+ expectSchemaMapping (
125+ schemaConfig ,
126+ ( ) => ( {
127+ [ SchemaElementKind . FIELD ] : ( config ) => ( {
128+ ...config ,
129+ description : 'Some description' ,
130+ } ) ,
131+ } ) ,
132+ `
133+ type SomeType {
134+ """Some description"""
135+ field: String!
136+ }
137+ ` ,
138+ ) ;
139+ } ) ;
140+
141+ it ( 'can map fields with list return type' , ( ) => {
142+ const sdl = `
143+ type SomeType {
144+ field: [String]
145+ }
146+ ` ;
147+
148+ const schemaConfig = buildSchema ( sdl ) . toConfig ( ) ;
149+
150+ expectSchemaMapping (
151+ schemaConfig ,
152+ ( ) => ( {
153+ [ SchemaElementKind . FIELD ] : ( config ) => ( {
154+ ...config ,
155+ description : 'Some description' ,
156+ } ) ,
157+ } ) ,
158+ `
159+ type SomeType {
160+ """Some description"""
161+ field: [String]
162+ }
163+ ` ,
164+ ) ;
165+ } ) ;
166+
115167 it ( 'maps fields after mapping arguments' , ( ) => {
116168 const sdl = `
117169 type SomeType {
You can’t perform that action at this time.
0 commit comments