This repository was archived by the owner on Mar 20, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +5
-13
lines changed Expand file tree Collapse file tree 1 file changed +5
-13
lines changed Original file line number Diff line number Diff line change @@ -2111,24 +2111,16 @@ function urlString(urlParams?: ?{ [param: string]: mixed, ... }) {
2111
2111
it ( 'allows for adding extensions' , async ( ) => {
2112
2112
const app = server ( ) ;
2113
2113
2114
- const extensions = ( { context = { } } ) => {
2115
- if ( context !== null && typeof context . startTime === 'number' ) {
2116
- return {
2117
- runTime : 1000000010 /* Date.now() */ - context . startTime ,
2118
- } ;
2119
- }
2120
-
2121
- return { } ;
2122
- } ;
2123
-
2124
2114
get (
2125
2115
app ,
2126
2116
urlString ( ) ,
2127
2117
graphqlHTTP ( ( ) => {
2128
2118
return {
2129
2119
schema : TestSchema ,
2130
- context : { startTime : 1000000000 } ,
2131
- extensions,
2120
+ context : { foo : 'bar' } ,
2121
+ extensions ( { context } ) {
2122
+ return { contextValue : JSON . stringify ( context ) } ;
2123
+ } ,
2132
2124
} ;
2133
2125
} ) ,
2134
2126
) ;
@@ -2140,7 +2132,7 @@ function urlString(urlParams?: ?{ [param: string]: mixed, ... }) {
2140
2132
expect ( response . status ) . to . equal ( 200 ) ;
2141
2133
expect ( response . type ) . to . equal ( 'application/json' ) ;
2142
2134
expect ( response . text ) . to . equal (
2143
- '{"data":{"test":"Hello World"},"extensions":{"runTime":10 }}' ,
2135
+ '{"data":{"test":"Hello World"},"extensions":{"contextValue":"{\\"foo\\":\\"bar\\"}" }}' ,
2144
2136
) ;
2145
2137
} ) ;
2146
2138
You can’t perform that action at this time.
0 commit comments