refactor(web): move component tests into sibling __tests__ directories#33623
refactor(web): move component tests into sibling __tests__ directories#33623CodingOnStar merged 2 commits intomainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on reorganizing the test files within the web application. It moves component-level tests into Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Pull request overview
This PR standardizes the web frontend’s unit test layout by moving component/hook/utility tests into sibling __tests__/ directories and updating docs and imports to match the new structure.
Changes:
- Updated testing documentation/guidance to require sibling
__tests__/directories for component/hook/utility tests. - Adjusted many test imports/mocks to account for tests now living under
__tests__/. - Added a new unit test suite for the
Array.prototype.toSplicedpolyfill behavior.
Reviewed changes
Copilot reviewed 37 out of 38 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| web/docs/test.md | Updates test placement/naming guidance to use sibling __tests__/ directories. |
| web/app/components/tools/workflow-tool/tests/utils.test.ts | Fixes relative imports after moving tests under __tests__/. |
| web/app/components/rag-pipeline/components/tests/index.spec.tsx | Tweaks act() usage around event callbacks to align with RTL expectations. |
| web/app/components/plugins/tests/use-plugins-with-latest-version.spec.ts | Updates imports to reflect new __tests__/ placement. |
| web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/tests/use-activate-credential.spec.tsx | Updates imports/mocks due to __tests__/ directory relocation. |
| web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/tests/usage-priority-section.spec.tsx | Updates imports due to __tests__/ directory relocation. |
| web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/tests/index.spec.tsx | Updates imports/mocks due to __tests__/ directory relocation. |
| web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/tests/dropdown-content.spec.tsx | Updates imports/mocks due to __tests__/ directory relocation. |
| web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/tests/dialog.spec.tsx | Updates imports/mocks due to __tests__/ directory relocation. |
| web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/tests/credits-exhausted-alert.spec.tsx | Updates imports/mocks due to __tests__/ directory relocation. |
| web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/tests/api-key-section.spec.tsx | Updates imports due to __tests__/ directory relocation. |
| web/app/components/header/account-setting/model-provider-page/provider-added-card/tests/use-trial-credits.spec.ts | Updates imports due to __tests__/ directory relocation. |
| web/app/components/header/account-setting/model-provider-page/provider-added-card/tests/use-credential-panel-state.spec.ts | Updates imports/mocks due to __tests__/ directory relocation. |
| web/app/components/header/account-setting/model-provider-page/provider-added-card/tests/use-change-provider-priority.spec.ts | Updates imports/mocks due to __tests__/ directory relocation. |
| web/app/components/header/account-setting/model-provider-page/provider-added-card/tests/system-quota-card.spec.tsx | Updates imports due to __tests__/ directory relocation. |
| web/app/components/header/account-setting/model-provider-page/provider-added-card/tests/provider-card-actions.spec.tsx | Updates imports due to __tests__/ directory relocation. |
| web/app/components/header/account-setting/model-provider-page/model-selector/tests/popover.spec.tsx | Updates imports/mocks due to __tests__/ directory relocation. |
| web/app/components/header/account-setting/model-provider-page/model-selector/tests/model-selector-trigger.spec.tsx | Updates imports/mocks due to __tests__/ directory relocation. |
| web/app/components/header/account-setting/model-provider-page/model-parameter-modal/tests/parameter-item.select.spec.tsx | Updates imports/mocks due to __tests__/ directory relocation. |
| web/app/components/header/account-setting/model-provider-page/model-parameter-modal/tests/derive-trigger-status.spec.ts | Updates imports due to __tests__/ directory relocation. |
| web/app/components/header/account-setting/model-provider-page/model-modal/tests/dialog.spec.tsx | Updates imports/mocks due to __tests__/ directory relocation. |
| web/app/components/header/account-setting/model-provider-page/tests/supports-credits.spec.ts | Updates imports due to __tests__/ directory relocation. |
| web/app/components/header/account-setting/model-provider-page/tests/index.non-cloud.spec.tsx | Updates imports/mocks due to __tests__/ directory relocation. |
| web/app/components/header/account-setting/model-provider-page/tests/derive-model-status.spec.ts | Updates imports due to __tests__/ directory relocation. |
| web/app/components/header/account-setting/model-provider-page/tests/atoms.spec.tsx | Updates imports due to __tests__/ directory relocation. |
| web/app/components/header/account-setting/members-page/edit-workspace-modal/tests/dialog.spec.tsx | Updates imports due to __tests__/ directory relocation. |
| web/app/components/header/account-setting/tests/menu-dialog.dialog.spec.tsx | Updates imports due to __tests__/ directory relocation. |
| web/app/components/base/prompt-editor/plugins/workflow-variable-block/tests/use-llm-model-plugin-installed.spec.ts | Updates imports due to __tests__/ directory relocation. |
| web/app/components/base/markdown-with-directive/components/tests/with-icon-card-list.spec.tsx | Updates imports due to __tests__/ directory relocation. |
| web/app/components/base/markdown-with-directive/components/tests/with-icon-card-item.spec.tsx | Updates imports due to __tests__/ directory relocation. |
| web/app/components/base/markdown-with-directive/components/tests/markdown-with-directive-schema.spec.ts | Updates imports due to __tests__/ directory relocation. |
| web/app/components/base/markdown-with-directive/tests/index.spec.tsx | Updates imports due to __tests__/ directory relocation. |
| web/app/components/base/file-uploader/tests/dynamic-pdf-preview.spec.tsx | Updates imports (including dynamic import) due to __tests__/ directory relocation. |
| web/app/components/base/amplitude/tests/utils.spec.ts | Updates imports/mocks due to __tests__/ directory relocation. |
| web/app/components/base/amplitude/tests/index.spec.ts | Updates imports due to __tests__/ directory relocation. |
| web/app/components/base/amplitude/tests/AmplitudeProvider.spec.tsx | Updates imports due to __tests__/ directory relocation. |
| web/app/components/tests/browser-initializer.spec.ts | Adds tests for toSpliced polyfill behavior. |
| .agents/skills/frontend-testing/SKILL.md | Updates agent testing skill doc to reflect sibling __tests__/ convention. |
Comments suppressed due to low confidence (1)
web/app/components/tools/workflow-tool/tests/utils.test.ts:3
- This file is named
utils.test.tswhile the surrounding sibling tests use the*.spec.ts(x)convention and the updated test guidelines in this PR also specify*.spec.*. To keep naming consistent and make test discovery predictable, rename this file toutils.spec.ts(and update any references if needed).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request refactors the test file structure by moving component tests into __tests__ subdirectories, co-locating them with their corresponding components. The changes primarily consist of moving files and updating import paths. The path changes appear correct across the numerous files. Additionally, the tests in web/app/components/rag-pipeline/components/__tests__/index.spec.tsx have been improved by correctly wrapping asynchronous updates in act, which should enhance test stability. Overall, this is a structural refactoring that improves test organization.
Important
Fixes #<issue number>.Summary
refactor(web): move component tests into sibling tests directories
Checklist
make lintandmake type-check(backend) andcd web && npx lint-staged(frontend) to appease the lint gods