chore: added initial tests for the component#26
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds initial test coverage for the weather forecast card component using Vitest and happy-dom. The tests validate rendering behavior, user interactions (like toggling between daily and hourly forecasts), and data display across different forecast modes.
- Configures Vitest with happy-dom environment and custom plugin for handling Parcel bundle-text imports
- Adds comprehensive tests for simple forecast, chart forecast, and general card functionality
- Reduces mock subscription timeout from 1000ms to 100ms to improve test execution speed
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| vitest.config.ts | Configures Vitest with happy-dom and custom plugin for Parcel compatibility |
| test/weather-forecast-simple.test.ts | Tests simple forecast mode rendering and interactions |
| test/weather-forecast-chart.test.ts | Tests chart forecast mode with canvas rendering and data validation |
| test/weather-forecast-card.test.ts | Tests core card functionality including temperature and condition display |
| test/vitest.setup.ts | Suppresses console output during tests |
| test/mocks/test-data.ts | Adds test fixture data for daily and hourly forecasts |
| test/mocks/hass.ts | Reduces subscription callback timeout for faster test execution |
| src/components/wfc-weather-condition-icon-provider.ts | Adds data-condition attribute to support test assertions |
| package.json | Adds test scripts and dependencies (vitest, happy-dom, @open-wc/testing) |
| .github/workflows/build.yml | Integrates test execution into CI workflow |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Tero Roininen <troinine@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.