Skip to content

Add edge case tests for validateAudio#215

Open
ysdede wants to merge 1 commit into
masterfrom
jules-test-validate-audio-edge-cases-8709087404552855067
Open

Add edge case tests for validateAudio#215
ysdede wants to merge 1 commit into
masterfrom
jules-test-validate-audio-edge-cases-8709087404552855067

Conversation

@ysdede

@ysdede ysdede commented May 28, 2026

Copy link
Copy Markdown
Owner

What: Missing edge case tests for validateAudio.
Coverage: Tests for type validation (TypeError for Arrays, strings, null), finite values (Error for NaN and Infinity), happy path for valid Float32Array and Float64Array, and empty arrays.
Result: Increased test coverage and confidence in validateAudio edge cases.


PR created automatically by Jules for task 8709087404552855067 started by @ysdede

Summary by Sourcery

Add edge case coverage for audio validation and expose the validateAudio helper for external use.

Enhancements:

  • Export validateAudio from the long audio module so it can be used and tested externally.

Tests:

  • Add tests verifying validateAudio rejects invalid input types such as arrays, strings, null, undefined, and plain objects.
  • Add tests ensuring validateAudio throws when audio buffers contain non-finite values like NaN or Infinity.
  • Add tests confirming validateAudio accepts empty typed arrays and finite Float32Array/Float64Array inputs.

Exported `validateAudio` from `src/long_audio.js` and added comprehensive edge-case tests to `tests/long_audio_chunking.test.mjs` verifying type checking, finite value validation (NaN, Infinity), empty arrays, and valid input arrays.
@google-labs-jules

This comment has been minimized.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • If validateAudio is intended to remain an internal helper, consider avoiding exporting it directly just for tests (e.g., test via the public API or expose it through a dedicated internal/testing export) to prevent unnecessary expansion of the public surface.
  • In the throws TypeError for invalid types test, using it.each/test.each (or separate test cases) instead of a loop would make it easier to identify which specific input caused a failure when the assertion breaks.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- If `validateAudio` is intended to remain an internal helper, consider avoiding exporting it directly just for tests (e.g., test via the public API or expose it through a dedicated internal/testing export) to prevent unnecessary expansion of the public surface.
- In the `throws TypeError for invalid types` test, using `it.each`/`test.each` (or separate test cases) instead of a loop would make it easier to identify which specific input caused a failure when the assertion breaks.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ysdede ysdede changed the title 🧪 [Add edge case tests for validateAudio] [Add edge case tests for validateAudio] May 29, 2026
@ysdede ysdede changed the title [Add edge case tests for validateAudio] Add edge case tests for validateAudio May 29, 2026
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