Do mock resolvers take inputs?

I am following this guide to create a simple mock for an existing API. However all the examples in the guide use simple resolvers which don’t take any input. This is what I mean.

const mocks = {
  Int: () => 6,
  Float: () => 22.1,
  String: () => 'Hello',
  .
  .
  .
  [SomeCustomType]: () =>[Some functionality]
};

I would like to create a mock having this shape.

[Sometype]: (parent, args, context, info)=>[Some functionality dependent on 
on the combination of parent, args, context and info]

I tried to create a simple mock with this shape but I got an undefined error.

String: (parent, args, context, info) => {
    return `${parent.name}`;
  }

Is that a limitation or we can use any type of resolver for to mock data for any type in our schema?

1 Like