Skip to content

test: add node:test coverage for beat-detection tick and toggle state - #13

Merged
OmikronApex merged 1 commit into
mainfrom
chore/add-basic-tests
Jul 8, 2026
Merged

OmikronApex merged 1 commit into
mainfrom
chore/add-basic-tests

Conversation

@OmikronApex

Copy link
Copy Markdown
Contributor

Twenty-fourth repo from the org test-coverage audit. screen.js has no wrapping IIFE at all — top-level const/function declarations are interleaved with real side effects (_metEnsureDrawHookInstalled(), a 60fps setInterval, and a playSong-wrapping IIFE) that run immediately on load. The module.exports hook uses a bare top-level return (valid inside the implicit CJS module-wrapper function) to exit before any of that, so requiring the file under node:test never leaves a live timer handle.

10 tests against a fake highway + stubbed AudioContext:

  • _metGetHighway: null when no global highway exists
  • _metTick: no-op without getBeats/getTime, resets flashAlpha to 0 while disabled, fires click+flash exactly at a beat boundary (measure vs. regular beat flash strength), fades without re-triggering on an already-seen beat, skips + marks-seen (without clicking) a beat more than 50ms in the past — the seek-tolerance guard
  • _metToggle: flips enabled, resets lastBeatIdx
  • _metSetVolume: 0-100 slider → 0-1 fraction
  • _metClick: bails before touching the oscillator when volume is 0

🤖 Generated with Claude Code

Node-only module.exports hook right before the polling
setInterval + playSong-wrapping IIFE (screen.js has no wrapping
IIFE of its own, so a top-level return exits the CJS module
wrapper before those side effects run — no live timer leaks into
the test process).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@OmikronApex, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 3 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8177c411-84e3-4e42-a867-4e33a0868323

📥 Commits

Reviewing files that changed from the base of the PR and between 2deb4f3 and 54b3f3d.

📒 Files selected for processing (2)
  • screen.js
  • tests/screen.test.js
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/add-basic-tests

Comment @coderabbitai help to get the list of available commands.

@OmikronApex
OmikronApex merged commit 1efcc0e into main Jul 8, 2026
3 checks passed
cchacs referenced this pull request in get-flashbacks/feedBack-plugin-metronome Jul 31, 2026
test: add node:test coverage for beat-detection tick and toggle state
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