Skip to content

tests: add emitOnStart: false, interval clamp, and maxPolls: 0 covera… - #370

Open
extolkom wants to merge 2 commits into
Sorokit:mainfrom
extolkom:fix/stream-account-tests
Open

tests: add emitOnStart: false, interval clamp, and maxPolls: 0 covera…#370
extolkom wants to merge 2 commits into
Sorokit:mainfrom
extolkom:fix/stream-account-tests

Conversation

@extolkom

Copy link
Copy Markdown
Contributor

Use this description when creating the PR at https://github.com/extolkom/core/pull/new/fix/stream-account-tests:

Closes #276.

Adds targeted tests for three untested `streamAccount` behaviors in `src/tests/account.test.ts`:

- **emitOnStart: false + maxPolls: 1** — verifies the stream yields exactly one result after the first `sleep`, not immediately.
- **intervalMs clamp** — verifies `intervalMs: 500` is clamped to `1000ms` (requires two `advanceTimersByTimeAsync(500)` calls to resolve).
- **emitOnStart: true + maxPolls: 0** — verifies the stream yields nothing and never sleeps.

All tests use `vi.useFakeTimers()` to control time and `vi.advanceTimersByTimeAsync(...)` to trigger poll cycles deterministically.

npx vitest run src/tests/account.test.ts -t "emitOnStart"

@drips-wave

drips-wave Bot commented Jul 31, 2026

Copy link
Copy Markdown

@extolkom Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@k-deejah

Copy link
Copy Markdown
Collaborator

Good job so far, Kindly resolve conflicts.

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