1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-06-10 11:25:28 +02:00
market/.storybook/storyshots.test.tsx
EnzoVezzaro 89f2521025
Storybook and unit testing setup (#1354)
* install and config Storybook

* create basic component for initial setup

* added testing-library / jest for testing

* restore coverage for testing

* downgrade codeclimate-actions to fix viable formatter issue

* clean up - remove unnecessary components in stories

* update readme with storybook and testing

* remove unnecessary file extensions on stories config

* remove babel and moved jest-dom to devDependencies

* delete introduction stories

* change test to .tsx

* change testing description on docs

* added interface to button story

* added build phase and update test phase

* restore build in ci

* added storyshots (automate testing) to Storybook

* simplify and update codeclimate-action

* restore workable version of codeclimate-action

* test unified test action for CI

* Revert "test unified test action for CI"

This reverts commit 039cbf3485.

* test documented solutions for CI

* fix error on coverage CI

* added codeCoverage on jest setup

* upload coverage report from jest

* added download artifact to coverage CI

* added upload artifact to coverage CI

* remove collectCoverageFrom

* moved test step on CI

* remove coverageLocations to allow default

* load Ocean typography into storybook

* skip all PRs coming from dependabot

* improve docs (Storybook)

Co-authored-by: Matthias Kretschmann <m@kretschmann.io>
2022-05-09 14:33:44 +01:00

15 lines
451 B
TypeScript

import initStoryshots from '@storybook/addon-storyshots'
import { render, waitFor } from '@testing-library/react'
// Stories are render-tested with @testing-library/react,
// overwriting default snapshot testing behavior
initStoryshots({
asyncJest: true,
test: async ({ story, done }) => {
const storyElement = story.render()
// render the story with @testing-library/react
render(storyElement)
await waitFor(() => done())
}
})