test: add unit tests for Oscilloscope widget#5835
Merged
omsuneri merged 1 commit intosugarlabs:masterfrom Feb 21, 2026
Merged
Conversation
Contributor
|
✅ All Jest tests passed! This PR is ready to merge. |
Contributor
vanshika2720
left a comment
There was a problem hiding this comment.
@kh-ub-ayb Nice work — strong coverage for constructor, animation lifecycle, and canvas handling.
Consider testing zoom via its actual handlers instead of directly modifying zoomFactor
Contributor
Author
|
@walterbender @omsuneri please review |
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.
Summary
This pr adds a new unit test suite for the
Oscilloscopewidget class with 51 comprehensive tests covering constructor setup, animation lifecycle, canvas management, and zoom calculations.Changes
js/widgets/__tests__/oscilloscope.test.jsTest Coverage
_running/_rafId/pitchAnalysers/_canvasState/drawVisualIDsinit,zoomFactor/verticalOffsetdefaults, widget windowclear/show/sendToCenter, zoom button creation, turtle filtering (null, trash, valid),drawbindingICONSIZE = 40,analyserSize = 8192_stopAnimation_runningto false, cancels_rafId, skips null_rafId, cancels per-turtledrawVisualIDs, skips null/undefined IDs_startAnimation_runningto true, callsdraw, no-op when already running_stopAnimation, clearsdrawVisualIDs/_canvasState/pitchAnalysers, callsdestroy, nullifieswidgetWindow, handles already-null windowdrawVisualIDsentry, handles multiple turtlesonclosedelegates toclose()Scope
js/widgets/__tests__/oscilloscope.test.jswas addedVerification