-
Notifications
You must be signed in to change notification settings - Fork 0
test: remove redundant integration tests #119
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughThe PR removes multiple integration test files across authentication, channels, rooms, spaces, and core CLI features, along with the shared test-utils module. Two test descriptions are renamed for clarity. Corresponding unit tests for channels publish and rooms messages are added to replace removed integration coverage. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–30 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
A lot of our integraiton tests are just unit tests with different mocking methods. This change removes tests that are covered by unit tests, moves some tests into relevant unit/e2e.
b4d8031 to
1bc60e4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
test/unit/commands/rooms/messages.test.ts (1)
239-342: Reduce reliance on real-time sleeps in delay/ordering testsThese tests assert on wall‑clock durations (e.g., ≥80ms, ≥200ms) using real timers, which can both slow the suite and be flaky on loaded CI runners.
Consider:
- Using Vitest fake timers (
vi.useFakeTimers(),vi.advanceTimersByTime(...)) to drive the delay loop deterministically, or- Making the timing assertions much more forgiving (e.g., only asserting that non‑zero delay takes “longer than zero” rather than specific millisecond thresholds), while still checking call counts and ordered
textvalues.This keeps the behavioral guarantees while making the tests faster and more stable.
test/unit/commands/channels/publish.test.ts (1)
408-563: Make timing-sensitive tests more robust and trim unused timing artifactsThe delay/ordering and multi‑message error‑handling tests look logically sound and mirror the rooms semantics, but a couple of refinements would improve robustness:
- Delay tests use real timers and assert on specific durations (
>= 80ms,>= 200ms,< 50ms). On slower or noisy CI, especially the< 50mscheck can intermittently fail even if behavior is correct.timestampsin Line 410 are collected but never asserted; they can be removed or used to assert ordering if you decide to keep time-based checks.Suggested adjustments:
- Prefer Vitest fake timers (
vi.useFakeTimers()/vi.advanceTimersByTime) to avoid real sleeps, or- Loosen the assertions to only distinguish “non‑zero delay vs zero delay” without tight millisecond bounds, and keep ordering verified via the
publishedDataarray.This will keep coverage of delay semantics and sequential ordering while reducing flakiness and runtime cost.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (16)
test/e2e/control-api.test.ts(1 hunks)test/integration/auth/auth-flow.test.ts(0 hunks)test/integration/auth/enhanced-login-flow.test.ts(0 hunks)test/integration/commands/channels-publish-ordering.test.ts(0 hunks)test/integration/commands/channels.test.ts(0 hunks)test/integration/commands/minimal-test.test.ts(0 hunks)test/integration/commands/rooms-messages-ordering.test.ts(0 hunks)test/integration/commands/rooms.test.ts(0 hunks)test/integration/commands/spaces.test.ts(0 hunks)test/integration/core/autocomplete.test.ts(0 hunks)test/integration/core/help.test.ts(0 hunks)test/integration/test-utils.ts(0 hunks)test/integration/topic-command-display.test.ts(0 hunks)test/unit/base-command/agent-header.test.ts(1 hunks)test/unit/commands/channels/publish.test.ts(1 hunks)test/unit/commands/rooms/messages.test.ts(1 hunks)
💤 Files with no reviewable changes (12)
- test/integration/core/help.test.ts
- test/integration/commands/rooms-messages-ordering.test.ts
- test/integration/test-utils.ts
- test/integration/commands/channels.test.ts
- test/integration/commands/rooms.test.ts
- test/integration/commands/spaces.test.ts
- test/integration/commands/channels-publish-ordering.test.ts
- test/integration/commands/minimal-test.test.ts
- test/integration/core/autocomplete.test.ts
- test/integration/topic-command-display.test.ts
- test/integration/auth/enhanced-login-flow.test.ts
- test/integration/auth/auth-flow.test.ts
🧰 Additional context used
📓 Path-based instructions (3)
**/*.test.ts
📄 CodeRabbit inference engine (.cursor/rules/AI-Assistance.mdc)
**/*.test.ts: When testing, mock the Ably SDK properly by stubbing the constructor (e.g., sinon.stub(Ably, 'Rest').returns(mockClient)).
Always ensure resources are properly closed/cleaned up in tests (e.g., call await client.close() and sinon.restore() in afterEach).
Files:
test/unit/commands/rooms/messages.test.tstest/e2e/control-api.test.tstest/unit/base-command/agent-header.test.tstest/unit/commands/channels/publish.test.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/Development.mdc)
**/*.{ts,tsx}: Use TypeScript and follow best practice naming conventions
ESLint is used to ensure all code adheres best practices; ensure you check that all code passes the linter before concluding your work.
Files:
test/unit/commands/rooms/messages.test.tstest/e2e/control-api.test.tstest/unit/base-command/agent-header.test.tstest/unit/commands/channels/publish.test.ts
{test/**/*.{ts,js},**/*.{test,spec}.{ts,js}}
📄 CodeRabbit inference engine (.cursor/rules/Development.mdc)
When new features are added or changes made, tests must be updated or added, and it is your responsibility to ensure the tests pass before deeming your work complete.
Files:
test/unit/commands/rooms/messages.test.tstest/e2e/control-api.test.tstest/unit/base-command/agent-header.test.tstest/unit/commands/channels/publish.test.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: session-tests
- GitHub Check: ui-tests
- GitHub Check: auth-tests
- GitHub Check: e2e-cli
- GitHub Check: test
🔇 Additional comments (3)
test/unit/base-command/agent-header.test.ts (1)
18-18: Describe label rename correctly reflects unit-test scopeRenaming the suite to "Agent Header Unit Tests" matches the file’s placement under
test/unitand clarifies intent without changing behavior.test/e2e/control-api.test.ts (1)
6-6: E2E suite label is clearer and consistent with test typeUpdating the description to "Control API E2E Tests" accurately signals that this is an end‑to‑end suite and doesn’t affect runtime behavior.
test/unit/commands/channels/publish.test.ts (1)
339-406: Transport-selection tests clearly encode expected defaultsThe new “transport selection” cases capture the intended matrix (multi‑message → realtime by default, explicit
restrespected, single message → REST by default) and should help prevent regressions as transport logic evolves. No issues from my side.
jamiehenson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.

A lot of our integraiton tests are just unit tests with different mocking methods. This change removes tests that are covered by unit tests, moves some tests into relevant unit/e2e.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.