Fix broken unit tests by converting Jasmine to Jest syntax #1076
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.
Problem
The unit tests for the time-planning-pn plugin were failing due to a mismatch between the test framework syntax used in the spec files and the actual test runner configuration. The spec files were using Jasmine syntax (
jasmine.SpyObj
,jasmine.createSpyObj
,.and.returnValue()
) while the project was configured to run tests with Jest (as evidenced by the test command using--testPathPatterns
).Solution
Converted all unit test spec files from Jasmine to Jest syntax to ensure compatibility with the Jest test runner. This involved systematic conversion of all mocking and spying patterns across 5 component spec files and verification of 1 service spec file.
Key Conversions
Type Declarations:
Mock Creation:
Return Values:
Spying on Methods:
Call Inspection:
Files Modified
time-plannings-container.component.spec.ts
time-plannings-table.component.spec.ts
assigned-site-dialog.component.spec.ts
workday-entity-dialog.component.spec.ts
download-excel-dialog.component.spec.ts
Documentation
Added
JEST_CONVERSION.md
with detailed conversion patterns, testing instructions, and verification checklist to help with future maintenance.Testing
Tests can now be run successfully with:
Impact
Fixes #[issue_number]
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.