Breaking Change (for Typescript users):
The TestQuery type (the type of the query and mutate functions) has been changed to use GraphQL's ExecutionResult generic type under the hood.
type TestQuery = <T extends object = {}, V extends object = {}>(
operation: StringOrAst,
options?: Options<V>
) => Promise<ExecutionResult<T>>; // previously, this returned `Promise<T>`If you are using typescript in your tests, you will need to update them to reflect this change. Here's an example:
// BEFORE THIS CHANGE
const { data } = await query<{ data: User[] }>(GET_USERS_QUERY);
// AFTER THIS CHANGE
const { data } = await query<User[]>(GET_USERS_QUERY);- Updated peer dependencies to include
graphql@^15.0.0. PR #14.
- Added new
setOptionsAPI to allow changing request/response mocking without having to create a new test client instance. PR #3.
- Allow mocked response to be extended as well via a new optional
extendMockResponseoption tocreateTestClient. PR #2.
- Add support for passing in
variablesparameter. PR #1.
First public stable release.