Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Clarify test mocks absolute configuration #96

Merged
merged 2 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions docs/source/code-generation/codegen-configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,10 @@ This option outputs all of your generated test mocks in a single directory.

Specify the directory for your test mocks using the `path` parameter. This is resolved as a relative path from the directory containing your `apollo-codegen-config.json` file when using the CLI. Use the `accessModifier` property to control the visibility of the generated code.

> **Note:** When using this option, you are responsible for ensuring the generated test mocks are linked to your test target.
>
> Test mocks generated this way may also be manually embedded in a test utility module that is imported by your test target.
> **Note:**
> * When using this option, you are responsible for ensuring the generated test mocks are linked to your test target.
> * Test mocks generated this way may also be manually embedded in a test utility module that is imported by your test target.
> * Test mocks are required to be in a target or module that is separate from the schema module and will always include `import` statements linking the schema module.

## Output options

Expand Down Expand Up @@ -754,4 +755,4 @@ Below is an example that illustrates an `apollo-codegen-config.json` where every
"warningsOnDeprecatedUsage" : "exclude"
}
}
```
```
2 changes: 1 addition & 1 deletion docs/source/testing/test-mocks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ When unit testing code that uses your generated operation models, you will often

## Purpose

Generated test mocks provide a type-safe way to mock your response models. Rather than dealing with cumbersome and error prone JSON data, test mocks make mocking safer,more concise, and reusable. They are mutable, offer code completion in Xcode, and update with new fields automatically as your schema and operations change.
Generated test mocks provide a type-safe way to mock your response models. Rather than dealing with cumbersome and error prone JSON data, test mocks make mocking safer, more concise, and reusable. They are mutable, offer code completion in Xcode, and update with new fields automatically as your schema and operations change.

### Mocking GraphQL responses with JSON

Expand Down
Loading