apollographql / apollographql/apollo-tooling

How can I deliberately fail a mutation for testing purposes?

Open
#2,673 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3k
Forks
460
PR merge metrics
No merged PRs in 30d

Description

For example in the following code, how do I make the code go into the ```.catch``` block

```
changeSubjectLine({
variables: {
campaignId,
},
})
.then(() => {
toast(successToast('Subject line dynamic saved.'));
})
.catch((e) => {
toast(errorToastConfig(e));
// I want the code to go into here
});

```
Is there a flag I can put in there to make it do that

Contributor guide

Open the contributing guide

Research direction

The issue names no files or tests; begin with the changeSubjectLine mutation call and its promise chain. Determine whether the client or Apollo tooling exposes a testable failure hook, then verify that the .catch callback receives an error.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.