Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component library unit tests #34

Merged
merged 15 commits into from
Jan 26, 2024
Merged

Component library unit tests #34

merged 15 commits into from
Jan 26, 2024

Conversation

danielnaab
Copy link
Contributor

@danielnaab danielnaab commented Jan 26, 2024

This PR includes unit tests for each UI component, wrapped with a helper called describeStories. This helper creates Vitest describe and test blocks for each story. The test renders stories via @testing-library/react, and if it exists, invokes its interaction test (play function).

This PR wraps up the provisioning of Storybook and design components for #21, implementsing #36.

…cribeStories - to compose storybook stories and their "play" functions into Vitest specs. Integrate so it's included with the workspace's coverage metrics. (there's a failing test that will be fixed in a follow-up commit.)
…n. This required added a "jsdom" environment annotation to every unit test file, despite there being a global jsdom environment configuration setting in the project. (running just the design test suite from the packages/design directory picks up the environment correctly; not so when the entire monorepo is tested at the same time).
Copy link

github-actions bot commented Jan 26, 2024

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 75.5% 3020 / 4000
🔵 Statements 75.5% 3020 / 4000
🔵 Functions 50.22% 113 / 225
🔵 Branches 78.03% 167 / 214
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
packages/design/src/test-helper.ts 100% 100% 100% 100%
packages/design/src/Form/Form.stories.tsx 100% 100% 100% 100%
packages/design/src/FormManager/FormManager.stories.ts 100% 100% 100% 100%
packages/design/src/FormManager/FormList/FormList.stories.tsx 100% 100% 100% 100%
packages/design/src/FormManager/FormView/index.tsx 58.92% 60% 50% 58.92% 27-29, 32-41, 47-56
packages/design/src/util/file-input.ts 100% 100% 100% 100%
packages/form-service/src/operations/get-form.ts 73.68% 50% 50% 73.68% 10-14
packages/forms/src/index.ts 79.32% 91.42% 65.38% 79.32% 95-97, 113, 115-119, 130-135, 144-146, 148-156, 167-168, 172-179
Generated in workflow #72

@danielnaab danielnaab merged commit c0997fd into main Jan 26, 2024
2 checks passed
@danielnaab danielnaab deleted the design-logic branch January 26, 2024 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant