Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

GraphQL mocking in Storybook - integration testing approach

Notifications You must be signed in to change notification settings

alanquigley-toast/grapql-mocking-in-storybook

Repository files navigation

Mocking Tweets

This project is designed to demonstrate an interesting way of mocking GraphQL within Storybook. This technique allows full integration testing of components, independantly of an external api. These components could can be packaged, released and used anywhere within the scope of the Toast graphql schema.

Available Scripts

In the project directory, you can run:

npm storybook

npm test

React Test Library

getByTestId

Using getByTestId helps prepare you interface for end-to-end testing. Its also encouraged that we target components via roles as this leaves us with more accessabler components.


Custom matchers:

  • toBeDisabled
  • toBeEnabled
  • toBeEmpty
  • toBeInTheDocument
  • toBeInvalid
  • toBeRequired
  • toBeValid
  • toBeVisible
  • toContainElement
  • toContainHTML
  • toHaveAttribute
  • toHaveClass
  • toHaveFocus
  • toHaveFormValues
  • toHaveStyle
  • toHaveTextContent
  • toHaveValue

About

GraphQL mocking in Storybook - integration testing approach

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published