Refactor synthutils export structure to properly support Jest tests and coverage #5820
Open
stutijain2006 wants to merge 3 commits intosugarlabs:masterfrom
Open
Refactor synthutils export structure to properly support Jest tests and coverage #5820stutijain2006 wants to merge 3 commits intosugarlabs:masterfrom
stutijain2006 wants to merge 3 commits intosugarlabs:masterfrom
Conversation
…t instance binding issues
Contributor
|
✅ All Jest tests passed! This PR is ready to merge. |
Contributor
|
@stutijain2006 please run prettier on modified files. |
Contributor
|
✅ All Jest tests passed! This PR is ready to merge. |
Contributor
|
Try rebasing this, I believe you ran prettier on synthutils.js too but it still shows formatting problems, maybe rebasing will work. |
Contributor
|
✅ All Jest tests passed! This PR is ready to merge. |
Contributor
Author
|
@omsuneri This PR increases the test coverage for synthutils and I believe this is ready to merged. Please see to it. |
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.
This PR fixes the export structure of synthutils.js so that Jest tests run correctly and coverage is properly recorded.
Earlier, although test cases were defined and running, the global test coverage was showing 0%, which indicated that functions were not being properly linked to the test environment. Some functions were also failing due to incorrect this binding and instance access.
Problem -
What was done-
const synthInstance = new Synth();All exported functions are now bound to this instance:
synthInstance.detectPitch = jest.fn(...)instead of modifying the classes directly.
Some global helpers used inside synthutils were not defined in the test environment.
Mocks were added to stabilize execution.
Final Result-
Importance of this PR-
Before-
After-