-
-
Notifications
You must be signed in to change notification settings - Fork 275
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
chore: remove unit test noise #16894
Conversation
WalkthroughThe changes modify several test suites by introducing new Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
⏰ Context from checks skipped due to timeout of 90000ms (10)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
packages/request-manager/tests/interceptor-whitelist.test.ts
(1 hunks)packages/suite/src/components/suite/Preloader/__tests__/Preloader.test.tsx
(2 hunks)packages/suite/src/utils/suite/__tests__/ethereumStaking.test.ts
(1 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
packages/request-manager/tests/interceptor-whitelist.test.ts
[error] 138-140: Disallow duplicate setup and teardown hooks.
Disallow beforeAll duplicacy inside the describe function.
(lint/suspicious/noDuplicateTestHooks)
⏰ Context from checks skipped due to timeout of 90000ms (10)
- GitHub Check: run-desktop-tests (@group=wallet, trezor-user-env-unix bitcoin-regtest)
- GitHub Check: run-desktop-tests (@group=other, trezor-user-env-unix)
- GitHub Check: run-desktop-tests (@group=settings, trezor-user-env-unix bitcoin-regtest)
- GitHub Check: run-desktop-tests (@group=device-management, trezor-user-env-unix)
- GitHub Check: run-desktop-tests (@group=suite, trezor-user-env-unix)
- GitHub Check: test-request-manager
- GitHub Check: build-web
- GitHub Check: Setup and Cache Dependencies
- GitHub Check: build-web
- GitHub Check: Analyze with CodeQL (javascript)
🔇 Additional comments (3)
packages/suite/src/utils/suite/__tests__/ethereumStaking.test.ts (1)
157-169
: LGTM!The implementation correctly filters object error messages while preserving non-object errors and the original console.error functionality.
packages/suite/src/components/suite/Preloader/__tests__/Preloader.test.tsx (2)
12-12
: LGTM!The change from div to span in the Translation mock is a minor UI adjustment that doesn't affect test functionality.
152-168
: LGTM!The implementation correctly filters specific warning messages while preserving the original console.warn functionality.
beforeAll(() => { | ||
jest.spyOn(console, 'error').mockImplementation(() => {}); | ||
}); |
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.
Move beforeAll block outside the forEach loop.
The beforeAll hook is defined inside a forEach loop, which creates duplicate hooks. This violates Jest's best practices and may lead to unexpected behavior.
Apply this diff to fix the issue:
- ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'].forEach(method => {
- beforeAll(() => {
- jest.spyOn(console, 'error').mockImplementation(() => {});
- });
+ beforeAll(() => {
+ jest.spyOn(console, 'error').mockImplementation(() => {});
+ });
+
+ ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'].forEach(method => {
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
beforeAll(() => { | |
jest.spyOn(console, 'error').mockImplementation(() => {}); | |
}); | |
beforeAll(() => { | |
jest.spyOn(console, 'error').mockImplementation(() => {}); | |
}); | |
['GET', 'POST', 'PUT', 'DELETE', 'PATCH'].forEach(method => { | |
// ... existing test code for each method | |
}); |
🧰 Tools
🪛 Biome (1.9.4)
[error] 138-140: Disallow duplicate setup and teardown hooks.
Disallow beforeAll duplicacy inside the describe function.
(lint/suspicious/noDuplicateTestHooks)
a351550
to
ec09434
Compare
Description