@@ -31,6 +31,7 @@ const RelayNetwork = require('relay-runtime/network/RelayNetwork');
31
31
const { graphql} = require ( 'relay-runtime/query/GraphQLTag' ) ;
32
32
const {
33
33
addTodo,
34
+ changeDescription,
34
35
completeTodo,
35
36
resetStore,
36
37
} = require ( 'relay-runtime/store/__tests__/resolvers/ExampleTodoStore' ) ;
@@ -279,6 +280,41 @@ describe.each([
279
280
expect ( renderer . toJSON ( ) ) . toEqual ( 'Test todo - green' ) ;
280
281
} ) ;
281
282
283
+ test ( 'read a field with arguments' , ( ) => {
284
+ function TodoComponentWithFieldWithArgumentsComponent ( props : {
285
+ todoID : string ,
286
+ } ) {
287
+ const data = useClientQuery (
288
+ graphql `
289
+ query RelayResolverModelTestFieldWithArgumentsQuery($id: ID!) {
290
+ todo_model(todoID: $id) {
291
+ fancy_description {
292
+ text_with_prefix(prefix: "[x]")
293
+ }
294
+ }
295
+ }
296
+ ` ,
297
+ { id : props . todoID } ,
298
+ ) ;
299
+ return data ?. todo_model ?. fancy_description ?. text_with_prefix ;
300
+ }
301
+
302
+ addTodo ( 'Test todo' ) ;
303
+
304
+ const renderer = TestRenderer . create (
305
+ < EnvironmentWrapper environment = { environment } >
306
+ < TodoComponentWithFieldWithArgumentsComponent todoID = "todo-1" />
307
+ </ EnvironmentWrapper > ,
308
+ ) ;
309
+ expect ( renderer . toJSON ( ) ) . toEqual ( '[x] Test todo' ) ;
310
+
311
+ TestRenderer . act ( ( ) => {
312
+ changeDescription ( 'todo-1' , 'Changed todo description text' ) ;
313
+ jest . runAllImmediates ( ) ;
314
+ } ) ;
315
+ expect ( renderer . toJSON ( ) ) . toEqual ( '[x] Changed todo description text' ) ;
316
+ } ) ;
317
+
282
318
test ( 'read interface field' , ( ) => {
283
319
function TodoComponentWithInterfaceComponent ( props : { todoID : string } ) {
284
320
const data = useClientQuery (
0 commit comments