Commit ccdb6c4
committed
Add comprehensive unit tests with vitest
- Added vitest as the testing framework with full configuration
- Created 130+ unit tests covering:
- Utils: random, lerp, randomElement, getSize functions
- Snowflake: initialization, updates, position wrapping, drawing
- SnowfallCanvas: config management, snowflake lifecycle, animation
- Hooks: useComponentSize, useSnowfallStyle, useDeepCompareEffect, useDeepMemo
- Set up jsdom environment with Canvas and ResizeObserver mocks
- Updated GitHub Actions workflow to run tests on PRs
- Upgraded actions/checkout and actions/setup-node to v4
- All tests passing (130 passed, 7 skipped due to timing constraints)
The test suite ensures code quality and prevents regressions in:
- Snowflake physics and movement logic
- Canvas rendering and cleanup
- React hooks behavior
- Configuration updates and validation1 parent 252fb40 commit ccdb6c4
9 files changed
Lines changed: 3915 additions & 207 deletions
File tree
- .github/workflows
- packages/react-snowfall
- src/test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
0 commit comments