test(logo): improve unit test coverage for Logo execution engine#7746
Merged
walterbender merged 1 commit intoJul 7, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7746 +/- ##
==========================================
+ Coverage 56.60% 56.70% +0.09%
==========================================
Files 172 172
Lines 57675 57675
==========================================
+ Hits 32645 32702 +57
+ Misses 25030 24973 -57 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
|
This PR has merge conflicts with Please rebase your branch: # Add upstream remote (one-time setup)
git remote add upstream https://github.com/sugarlabs/musicblocks.git
# Fetch latest master and rebase
git fetch upstream
git rebase upstream/master
# Resolve any conflicts, then:
git push --force-with-lease origin YOUR_BRANCH
|
93b7d53 to
d46cf95
Compare
d46cf95 to
b3f678f
Compare
5d3a111 to
a70cb43
Compare
Contributor
|
This PR has merge conflicts with Please rebase your branch: # Add upstream remote (one-time setup)
git remote add upstream https://github.com/sugarlabs/musicblocks.git
# Fetch latest master and rebase
git fetch upstream
git rebase upstream/master
# Resolve any conflicts, then:
git push --force-with-lease origin YOUR_BRANCH
|
a70cb43 to
78690bf
Compare
Adds 112 tests covering previously untested branches across the Logo execution engine. All tests are in js/__tests__/logo.test.js; no production code is modified. Coverage additions - Queue constructor: null args, empty array args - Logo constructor: all property initialisations, widget defaults, empty dictionaries, Notation/Synth/StatusMatrix construction - Logo getters/setters: turtleDelay, notation, setCameraID - Logo clearNoteParams: singer fields reset, per-turtle scope - Logo safePluginExecute: normal execution, error catching, whitelisted math patterns (unary / binary / constants / parameter plugin), blocked arbitrary string code - Logo plugin registration: evalFlowDict, evalArgDict, evalParameterDict, evalOnStartList, evalOnStopList - Logo prepSynths / resetSynth: instrument copy across turtles, volume reset, synth engine start - Logo doStopTurtles: stopTurtle flag, block/highlight teardown, cursor reset, clearTimeout for pending timers, timerManager.clearAll, Transport cancellation and audio-stream cleanup with two-turtle scenarios - Logo runLogoCommands: startHere / startBlocks dispatch, evalOnStartList hooks, cursor fallback, listener removal from stage, drum-block inclusion, already-running guard, action-block registration - Logo runFromBlock: step-mode queuing, timeout scheduling, Transport schedule / fallback paths - Logo runFromBlockNow: stopTurtle guard, _iterationBudget MAX_ITERATIONS guard, profiling on/off via performanceTracker, evalFlowDict dispatch, embedded-graphics scheduling, flow-plugin execution, unhighlight queue processing, parameter-block updates, empty-queue termination - Logo clearTurtleRun: clearTimeout resume, Transport event cancel, no-op when nothing pending - Logo parseArg: number/string/named-box/action-box/colour return types, error paths, StatusMatrix field registration - Logo dispatchTurtleSignals: EmbeddedGraphicsScheduler delegation, dispatch-factor thresholds (NOTEDIV steps) via test.each - Logo timerManager: clearAll / getStats / setGuardedTimeout API - Logo updateNotation / notationMIDI / initMediaDevices / processShow Test structure - Flat per-feature describe blocks with nested sub-describes where a single feature has multiple distinct behaviours - Shared helpers: setupLogoEnv(), createMockTurtle(), createMockActivity(), createTwoTurtleActivity(), makeFlowBlock(), makeNumArgBlock() - No implementation-detail assertions (private fields, internal queues, timer IDs); tests verify externally observable behaviour only Signed-off-by: Vanshika <pahalvanshikaa@gmail.com>
78690bf to
18d057c
Compare
Contributor
Author
Member
|
Wow. A big improvement. Thx. |
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 improves the unit test coverage for
logo.jsby adding comprehensive tests for previously untested logic and important edge cases. No production code is modified.Changes Made
Added tests for
safePluginExecute()Expanded
parseArg()coveragedectofracwith null and non-number child valuesreturnValuewith empty and populated stacksevalArgDictdispatchAdded
dispatchTurtleSignals()tests> 100> 50> 25> 12.5≤ 12.5Added timer manager tests
clearAll()getStats()setGuardedTimeout()when:Added
doStopTurtles()testsAdded
runLogoCommands()testsevalOnStartListplugin executionstartBlocksAdded
runFromBlockNow()testsMAX_ITERATIONSguardevalFlowDictplugin dispatchAdded constructor compatibility tests
Added miscellaneous edge-case tests
stepQueueclearNoteParams()state resetCoverage Improvement (
logo.js)Testing Performed
npx jest js/tests/logo.test.jsChecklist