Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comprehensive Unit Tests for Pitch & Tone Block Components #4480

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

PriyamvadaShah
Copy link

This adds comprehensive Jest test coverage for the Pitch and Tone block components, focusing on proper initialization, error handling, and integration behavior. The tests verify both individual block functionality and interactions between related blocks, ensuring that musical operations (key signature, scale, transposition, oscillators, and audio effects) work correctly.

PitchBlocks Tests:

  • Key block validation with both valid and invalid musical keys
  • Scale block functionality with different scale types
  • Transposition block with semitone range verification
  • Integration tests between key, scale, and transposition blocks
  • Error handling for edge cases (null inputs, invalid signatures)
  • State isolation between multiple turtles

ToneBlocks Tests:

  • Oscillator configuration with various waveform types and partials
  • Audio effect blocks
  • Synthesis blocks
  • Harmonic and partial handling for complex timbre creation
  • Parameter validation and proper error messaging

Designed these in order to test that the PitchBlocks and ToneBlocks work as intended and cover all edge cases.

Kindly review this PR and suggest any changes, if required :)

Copy link

github-actions bot commented Mar 2, 2025

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

@walterbender
Copy link
Member

Please add a license (see the other test files) to these files.

Copy link

github-actions bot commented Mar 3, 2025

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

Copy link

github-actions bot commented Mar 3, 2025

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

@omsuneri
Copy link
Member

omsuneri commented Mar 3, 2025

@walterbender this PR is not following our guide to add tests instead of mocking variables and function in the test itself it is creating an another mock.js file which is strictly prohibited as we get into trouble as someone did this in the synthutils i think @PriyamvadaShah you need to refactor your test looking at our adding test guide in js directory

@omsuneri
Copy link
Member

omsuneri commented Mar 3, 2025

@PriyamvadaShah also you are not following the actual nomenclature for the test file we are doing in MB again you are not supposed to edit the .json file please do follow the guide and refactor all the changes suggested according to that

@PriyamvadaShah
Copy link
Author

@omsuneri Thank you so much for pointing these out. Will make changes to make sure I adhere to the guidelines!

@omsuneri
Copy link
Member

omsuneri commented Mar 3, 2025

@PriyamvadaShah also please mock the fun in the test itself only don't create another mock.js as it becomes very hard for debugging the failure of any test in future

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.

3 participants