File tree Expand file tree Collapse file tree 1 file changed +15
-16
lines changed
packages/graphql-yoga/__tests__ Expand file tree Collapse file tree 1 file changed +15
-16
lines changed Original file line number Diff line number Diff line change @@ -39,23 +39,22 @@ describe('schema', () => {
3939 } ) ;
4040
4141 it ( 'schema factory function' , async ( ) => {
42- const schemaFactory = async ( ctx : { request : Request } ) => {
43- const strFromContext = ctx . request . headers . get ( 'str' ) ;
44- return createSchema ( {
45- typeDefs : /* GraphQL */ `
46- type Query {
47- foo: String
48- }
49- ` ,
50- resolvers : {
51- Query : {
52- foo : ( ) => strFromContext ,
53- } ,
54- } ,
55- } ) ;
56- } ;
5742 const yoga = createYoga ( {
58- schema : schemaFactory ,
43+ async schema ( ctx ) {
44+ const strFromContext = ctx . request . headers . get ( 'str' ) ;
45+ return createSchema ( {
46+ typeDefs : /* GraphQL */ `
47+ type Query {
48+ foo: String
49+ }
50+ ` ,
51+ resolvers : {
52+ Query : {
53+ foo : ( ) => strFromContext ,
54+ } ,
55+ } ,
56+ } ) ;
57+ } ,
5958 } ) ;
6059 const query = `{foo}` ;
6160 let result = await yoga . fetch ( 'http://yoga/graphql' , {
You can’t perform that action at this time.
0 commit comments