Skip to content

test: add unit tests for PhraseMakerGrid widget#5805

Merged
omsuneri merged 1 commit intosugarlabs:masterfrom
kh-ub-ayb:test/add-phrasemaker-grid-tests
Feb 19, 2026
Merged

test: add unit tests for PhraseMakerGrid widget#5805
omsuneri merged 1 commit intosugarlabs:masterfrom
kh-ub-ayb:test/add-phrasemaker-grid-tests

Conversation

@kh-ub-ayb
Copy link
Contributor

Summary

This pr adds a new unit test suite for the PhraseMakerGrid widget module, covering all 8 of its grid/matrix state management methods with 61 comprehensive tests.

Changes

  • Added 61 new unit tests in js/widgets/__tests__/PhraseMakerGrid.test.js
  • No changes to source code

Test Coverage

Describe Block Tests Coverage
Module Export 8 Verifies all 8 method exports
clearBlocks 6 Resets _rowBlocks, _colBlocks, _rowMap, _rowOffset; preserves other properties
addRowBlock 6 Sequential adds, _rowMap / _rowOffset tracking, duplicate handling with 1000000 offset
addColBlock 5 Single/multi-entry adds, repeated rhythm blocks with index increment, n=0 edge case
addNode 7 _blockMap creation, node structure [row, [rhythm, n], j], duplicate j increment, separate blk keys
removeNode 6 Matching removal, non-matching preservation (different row/rhythm/n), blockNo-scoped mutation
mapNotesBlocks 7 Block chain traversal, name filtering, withName pairs, "all" mode excluding hidden/vspace/hiddennoFlow
lookForNoteBlocksOrRepeat 9 newnote / repeat flag detection, skip -1/null/undefined blocks, early exit, reset behavior
syncMarkedBlocks 6 -1 filtering, helper mapping, deduplication, empty/no-match edge cases, blockNo scoping

Scope

  • Only js/widgets/__tests__/PhraseMakerGrid.test.js was added
  • No changes to source code

Verification

  • All 61 tests pass

@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@kh-ub-ayb
Copy link
Contributor Author

@walterbender @omsuneri please review

@omsuneri omsuneri merged commit 6800039 into sugarlabs:master Feb 19, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants