Skip to content

Commit

Permalink
docs(README): recent example links (#1202)
Browse files Browse the repository at this point in the history
* docs(README): internal links in Typescript Testing React section

docs: recent link

* docs(README): link caption extension
  • Loading branch information
guspan-tanadi authored Jul 4, 2024
1 parent 0f98171 commit 4aa3b12
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1176,9 +1176,9 @@ console.log(result.error) // The `error` object will have a `graphQLErrors` arra

### Testing with React

Example tests that use the `LocalGraphQLClient` are provided in [the examples/create-react-app/test folder](https://github.com/nearform/graphql-hooks/blob/master/mock-client/examples/create-react-app/test/Posts.test.js).
Example tests that use the `LocalGraphQLClient` are provided in [the examples/create-react-app/test folder](https://github.com/nearform/graphql-hooks/blob/master/examples/create-react-app/test/Posts.test.tsx).

The [test-utils.js](https://github.com/nearform/graphql-hooks/blob/liana/mock-client/examples/create-react-app/test/test-utils.js) is a good example of how to create a custom render function using [@testing-library/react](https://testing-library.com/docs/react-testing-library/intro/) which can wrap the render of a React component in a `ClientContext` setup to use the `LocalGraphQLClient` with supplied local queries:
The [test-utils.tsx](https://github.com/nearform/graphql-hooks/blob/master/examples/create-react-app/test/test-utils.tsx) is a good example of how to create a custom render function using [@testing-library/react](https://testing-library.com/docs/react-testing-library/intro/) which can wrap the render of a React component in a `ClientContext` setup to use the `LocalGraphQLClient` with supplied local queries:

```js
const customRender = (ui, options) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql-hooks/src/middlewares/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Middleware is a function with 2 parameters:
- `operation` - GraphQL operation object - includes `query`, `variables` etc.
- `addResponseHook` - a function that can be called from within the middleware to add a response hook - it accepts a handler to read/transform and return the data - passthrough ex.: `addResponseHook(response => response)`
- `client` - the GraphQLClient instance
- `resolve`, `reject` - advanced usage only, these would be used only when we want to resolve/reject the request `Promise` early without doing the usual fetch (see [example](examples/cacheMiddleware.js))
- `resolve`, `reject` - advanced usage only, these would be used only when we want to resolve/reject the request `Promise` early without doing the usual fetch (see [example](examples/cacheMiddleware.ts))
- `next` function - calls the next middleware function in line. Generally it should always be called, unless we want to change the control flow

## Automatic Persisted Queries (APQ) middleware
Expand Down

0 comments on commit 4aa3b12

Please sign in to comment.