From 34b24443477aec83c2690823a6f93a8fd1d4f38b Mon Sep 17 00:00:00 2001 From: Enzo Vezzaro Date: Fri, 22 Apr 2022 09:37:28 -0400 Subject: [PATCH] update readme with storybook and testing --- README.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/README.md b/README.md index 163863524..079ee685f 100644 --- a/README.md +++ b/README.md @@ -294,6 +294,41 @@ npm run lint npm run format ``` +## 👩‍🎤 Storybook + +Storybook helps us build UI components in isolation from our app's business logic, data, and context. That makes it easy to develop hard-to-reach states and save these UI states as stories to revisit during development, testing, or QA. + +To start adding stories, create a `index.stories.tsx` inside the component's folder: + +
+src
+└─── components
+│   └─── @shared
+│       └─── 
+│            │   index.tsx
+│            │   index.module.css
+│            │   index.stories.tsx
+│            │   index.test.tsx
+
+ +You can also write a [test](https://storybook.js.org/docs/react/writing-tests/importing-stories-in-tests#example-with-testing-library) against your story by creating a `index.test.tsx` file. + +## 🤖 Testing + +Test suite for unit & integration tests is setup with Storybook's Addon for [Testing Library](https://storybook.js.org/docs/react/writing-tests/importing-stories-in-tests#example-with-testing-library), which utilizes [Jest](https://jestjs.io/) as test runner. A combined coverage report is sent to CodeClimate via the coverage GitHub Actions job. + +Executing linting, type checking, unit, and integration tests: + +```bash +npm run test +``` + +Executing only unit, and integration tests: + +```bash +npm run jest +``` + ## 🛳 Production To create a production build, run from the root of the project: