Test: expand musicutils core coverage#6474
Conversation
|
✅ All Jest tests passed! This PR is ready to merge. |
e751d6c to
ea0ca4b
Compare
|
✅ All Jest tests passed! This PR is ready to merge. |
vanshika2720
left a comment
There was a problem hiding this comment.
@sapnilbiswas Some behaviors are being tested in multiple ways (VM + jest.requireActual), which adds redundancy and complexity. Also, globals aren’t cleaned up between tests.
Please simplify to one approach
|
✅ All Jest tests passed! This PR is ready to merge. |
|
Thanks, @vanshika2720, for the review. I have tried reducing the redundancy in the test |
vanshika2720
left a comment
There was a problem hiding this comment.
@sapnilbiswas Thanks for the update and improved coverage! A few things still need attention:
Some duplicate test blocks — please clean those up
Mixed testing approaches — consider using a single consistent method
Globals aren’t cleaned between tests — add proper teardown
A few assertions are a bit brittle
|
✅ All Jest tests passed! This PR is ready to merge. |
|
✅ All Jest tests passed! This PR is ready to merge. |
There was a problem hiding this comment.
Pull request overview
This PR expands Jest unit test coverage for js/utils/musicutils.js, focusing on core music constants, scale/mode utilities, and additional lookup/mapping branches to reduce the risk of silent regressions in foundational music logic.
Changes:
- Added a new test file to validate core constants (note names, solfege, accidentals, and mode definitions).
- Expanded existing
musicutilstests with additional cases for lookup fallbacks and mode/scale-mapping branches. - Increased coverage for
js/utils/musicutils.js(per PR description).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
js/utils/__tests__/musicutils.test.js |
Adds helper-based global overrides and new test cases to hit additional fallback/mode-mapping branches. |
js/__tests__/utils/musicutils.test.js |
Introduces focused tests for core music constants and mode definitions by loading constants from musicutils.js. |
Comments suppressed due to low confidence (1)
js/utils/tests/musicutils.test.js:1137
- This
withGlobalOverridessetup looks unused:getCustomNotereferencesDOUBLEFLAT/DOUBLESHARP/FLAT/SHARPfrom the module scope inmusicutils.js, not fromglobal. Removing the override would reduce noise and avoid implying these symbols are configurable via globals.
it("should handle array input by taking first element", () => {
expect(getCustomNote(["C", "other"])).toBe("C");
expect(getCustomNote(["D#", "other"])).toBe("D♯");
});
it("should convert double flat notation", () => {
expect(getCustomNote("Cbb")).toBe("C𝄫");
expect(getCustomNote("Dbb")).toBe("D𝄫");
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
✅ All Jest tests passed! This PR is ready to merge. |
There was a problem hiding this comment.
@sapnilbiswas Looks much cleaner, thanks!
but still above issue remains
|
✅ All Jest tests passed! This PR is ready to merge. |
|
Thank you for the follow-up review. I did one more small cleanup pass that only focused on making things consistent:
Checked again locally after the update:
When you have a chance, please look again. |
|
Please let me know if something specifically needed |
|
@walterbender Sir can you please review my PR and let me know if there is anything i am missing at |
There was a problem hiding this comment.
Hi @sapnilbiswas, this PR seems to be a duplicate of #6470. We should probably consolidate our efforts there to keep the PR history clean!
|
✅ All Jest tests passed! This PR is ready to merge. |
70347d5 to
5e86191
Compare
|
✅ All Jest tests passed! This PR is ready to merge. |
|
Merge conflicts resolved. Ready for review. |
|
✅ All Jest tests passed! This PR is ready to merge. |
|
✅ All Jest tests passed! This PR is ready to merge. |
|
@Ashutoshx7 @vanshika2720 I have tried resolving all the scope creep and making it clean. Could you please help me with reviewing it |
|
✅ All Jest tests passed! This PR is ready to merge. |
reviewing it right away |
|
✅ All Jest tests passed! This PR is ready to merge. |
|
are u stil working on this |
I am done with it. You can go ahead with reviewing |
|
This PR is extremely clean, addresses redundancy in the test suite as requested during review, and follows all repository patterns. I am 100% confident that this is ready for merge. |
Thanks @Ashutoshx7 for reviewing this |
Summary
Adds focused unit tests for
musicutils.jscore constants and mode utilities.Changes
js/__tests__/utils/musicutils.test.jscovering note names, solfege names, accidentals, and mode definitionsjs/utils/__tests__/musicutils.test.jsto cover additional core lookup and mode-mapping branchesjs/utils/musicutils.jsstatement coverage to 63.68%Testing
npm test -- --coverage --runTestsByPath js/utils/__tests__/musicutils.test.js js/__tests__/utils/musicutils.test.js --collectCoverageFrom=js/utils/musicutils.jsnpm test -- --json --outputFile=jest-results.jsonPR category
Fixes #6471