Skip to content

Commit

Permalink
docs: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
joual committed Mar 13, 2020
1 parent d00f221 commit 1a133f0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ This library provides a developer-friendly method to mock your GraphQL requests.
```js
import { mock } from 'graphql-ergonomock';

// Given a particular GraphQL Schema, ...
const schema = gql`
type Shape {
id: ID!
Expand All @@ -83,6 +84,7 @@ const schema = gql`
}
`;

// ...a GraphQL query, ...
const query = gql`
{
getShape {
Expand All @@ -98,6 +100,7 @@ const query = gql`
}
`;

// ...and a partial, possibly nested shape of data...
const mocks = {
getShape: {
nestedShape: {
Expand All @@ -109,6 +112,7 @@ const mocks = {
}
};

// ... provides the expected object filled with mock data
const resp = mock(schema, query, mocks);
expect(resp.data).toMatchObject({
id: expect.toBeString(),
Expand All @@ -123,7 +127,6 @@ expect(resp.data).toMatchObject({
```

### Built With
This section should list any major frameworks that you built your project using. Leave any add-ons/plugins for the acknowledgements section. Here are a few examples.
* [Typescript](https://www.typescriptlang.org/)
* [GraphQL](https://graphql.org)
* [Jest](https://jestjs.io)
Expand Down

0 comments on commit 1a133f0

Please sign in to comment.