@@ -42,9 +42,9 @@ var queryType = new GraphQLObjectType({
42
42
description : 'Map from a username to the user' ,
43
43
inputType : GraphQLString ,
44
44
outputType : userType ,
45
- resolveSingleInput : ( username ) => ( {
45
+ resolveSingleInput : ( username , { rootValue : { lang } } ) => ( {
46
46
username : username ,
47
- url : 'www.facebook.com/' + username
47
+ url : 'www.facebook.com/' + username + '?lang=' + lang
48
48
} )
49
49
} )
50
50
} )
@@ -54,6 +54,8 @@ var schema = new GraphQLSchema({
54
54
query : queryType
55
55
} ) ;
56
56
57
+ var rootVal = { lang : 'en' } ;
58
+
57
59
describe ( 'pluralIdentifyingRootField()' , ( ) => {
58
60
it ( 'allows fetching' , ( ) => {
59
61
var query = `{
@@ -66,20 +68,20 @@ describe('pluralIdentifyingRootField()', () => {
66
68
usernames : [
67
69
{
68
70
username : 'dschafer' ,
69
- url : 'www.facebook.com/dschafer'
71
+ url : 'www.facebook.com/dschafer?lang=en '
70
72
} ,
71
73
{
72
74
username : 'leebyron' ,
73
- url : 'www.facebook.com/leebyron'
75
+ url : 'www.facebook.com/leebyron?lang=en '
74
76
} ,
75
77
{
76
78
username : 'schrockn' ,
77
- url : 'www.facebook.com/schrockn'
79
+ url : 'www.facebook.com/schrockn?lang=en '
78
80
} ,
79
81
]
80
82
} ;
81
83
82
- return expect ( graphql ( schema , query ) ) . to . become ( { data : expected } ) ;
84
+ return expect ( graphql ( schema , query , rootVal ) ) . to . become ( { data : expected } ) ;
83
85
} ) ;
84
86
85
87
it ( 'correctly introspects' , ( ) => {
0 commit comments