You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/development-testing/schema-driven-testing.mdx
+79-6
Original file line number
Diff line number
Diff line change
@@ -70,6 +70,7 @@ export function Products() {
70
70
);
71
71
}
72
72
```
73
+
73
74
</ExpansionPanel>
74
75
75
76
Now let's write some tests using a test schema created with the `createTestSchema` utility that can then be used to create a mock fetch implementation with `createSchemaFetch`.
@@ -155,7 +156,6 @@ const config: Config = {
155
156
};
156
157
157
158
exportdefaultconfig;
158
-
159
159
```
160
160
161
161
In the example `setupTests.ts` file below, `@testing-library/jest-dom` is imported to allow the use of custom `jest-dom` matchers (see the [`@testing-library/jest-dom` documentation](https://github.com/testing-library/jest-dom?tab=readme-ov-file#usage) for more information) and fragment warnings are disabled which can pollute the test output:
@@ -344,10 +344,7 @@ import graphqlSchema from "../../../schema.graphql";
344
344
// This should be a function that returns a new ApolloClient instance
345
345
// configured just like your production Apollo Client instance - see the FAQ.
## Modifying a test schema using `testSchema.add` and `testSchema.fork`
438
+
439
+
If you need to make changes to the behavior of a schema after it has been created, you can use the `testSchema.add` method to add new resolvers to the schema or overwrite existing ones.
440
+
This can be useful for testing scenarios where the behavior of the schema needs to change inside a test.
0 commit comments