1

I'm using Storybook with an Apollo graphql frontend. The component I'm creating stories for treats the graphql networkError differently from graphQLErrors. In the Storybook apollo client add-on documentation there is an example of mocking an error:

import DashboardPage, { DashboardPageQuery } from '.';

export default {
  title: 'My Story',
};

export const Example = () => <DashboardPage />;

Example.parameters = {
  apolloClient: {
    mocks: [
      {
        request: {
          query: DashboardPageQuery,
        },
        error: new Error('This is a mock network error'),
      },
    ],
  },
};

But this is always treated as a networkError as far as I can tell. Is there a way to create separate mock responses for graphQLErrors and networkError?

ACPrice
  • 667
  • 2
  • 10
  • 25

0 Answers0