Skip to content

test: add unit tests for AIWidget#5941

Open
kh-ub-ayb wants to merge 1 commit intosugarlabs:masterfrom
kh-ub-ayb:test/add-aiwidget-tests
Open

test: add unit tests for AIWidget#5941
kh-ub-ayb wants to merge 1 commit intosugarlabs:masterfrom
kh-ub-ayb:test/add-aiwidget-tests

Conversation

@kh-ub-ayb
Copy link
Contributor

Summary

This PR adds a new unit test suite targeting the AIWidget to test the constructor, initialization steps, and helper methods.

Changes

  • Added 13 new unit tests in js/widgets/tests/aiwidget.test.js
  • No changes to source code

Test Coverage

Describe Block Tests Coverage
Constructor and Properties 1 Ensures basic properties (sample configuration, centers, tracking objects) initialize correctly without throwing.
State Modifiers 3 Tests behavior of _usePitch, _useAccidental, and _useOctave properly updating internal pointer variables.
Init Method 1 Verifies that widget window instantiates correctly, creates buttons, and sets up analysis listeners on load.
Methods and Helpers 8 Extensively tests pure and interdependent methods required for AI audio sampling: threshold checking (getSampleLength), adding custom tracks (_addSample), connecting references to Tone.Analyser (reconnectSynthsToAnalyser), and triggering/stopping playback variables (_playSample, pause, resume).

Scope

  • Only js/widgets/tests/aiwidget.test.js was added.

Verification

  • All 13 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

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.

1 participant