Skip to content

Instantly share code, notes, and snippets.

@stubailo
Created November 26, 2018 17:10
Show Gist options
  • Select an option

  • Save stubailo/b5e6a5865c123417a7ee9d780ba36456 to your computer and use it in GitHub Desktop.

Select an option

Save stubailo/b5e6a5865c123417a7ee9d780ba36456 to your computer and use it in GitHub Desktop.

Revisions

  1. stubailo created this gist Nov 26, 2018.
    13 changes: 13 additions & 0 deletions graphql-tools-mock-resolvers.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    import faker from 'faker';

    const mocks = {
    Todo: () => ({
    text: () => faker.sentence(),
    completed: () => faker.random.boolean(),
    }),
    User: () => ({
    name: () => faker.name.findName()
    })
    }

    addMockFunctionsToSchema({ schema, mocks });