Skip to content

Frontend tests: migrate file browser, server form, server list, terminal and root-level tests to the shared api mock #908

Open

Description

@smart-ssh-planner

Goal

The remaining test files use the shared createApiMock(); after this issue no test file in the frontend has a hand-written api factory.

Context

After the shared helpers exist (blocked-by issue), these files under apps/smart-ssh-community/frontend/src/ still have their own vi.mock("…/api", () => ({ … })) factory:

  • components/FileBrowserPanel.test.tsx (≈ 3,400 lines), components/FileBrowserPanel.android.test.tsx, components/FileBrowserPanel.startDirectory.test.tsx
  • components/ServerForm.test.tsx, ServerForm.android.test.tsx, ServerForm.extensionTabs.test.tsx, ServerForm.noPassword.test.tsx, ServerForm.startDirectory.test.tsx, ServerForm.tabs.test.tsx, ServerForm.testDialog.test.tsx, ServerForm.textCorrection.test.tsx
  • components/ServerList.copyMarker.test.tsx, ServerList.narrow.test.tsx, ServerList.test.tsx
  • components/TerminalView.keys.test.tsx, TerminalView.test.tsx
  • App.hostKeyPrompt.test.tsx, treeDrag.test.ts, useLocalEditSession.test.ts, useSessionTabs.connect.test.ts, useSessionTabs.test.ts
  • plus any file the previous migrations missed (grep -rlE 'vi\.mock\("(\.\./|\./|\.\./\.\./)api", *\(\) *=>' src).

Requirements

  • Same as the previous migration: createApiMock({...overrides}), shared stubs into src/test/fixtures.ts, test cases unchanged.
  • Add a guard test (src/test/noHandWrittenApiMock.test.ts) that fails when a test file defines a hand-written factory for the api module.

Acceptance Criteria

  • The grep above returns nothing; the guard test passes and fails on a fixture string with a hand-written factory.
  • Number of test cases per file unchanged (before/after list in the PR).
  • npm test, npm run lint and the type-check pass.

Technical Notes

  • Tests only. FileBrowserPanel.test.tsx and ServerForm*.test.tsx may be split by the component decomposition work at the same time; rebase rather than duplicate.

Spec impact: none

Related Work

Activity

  1. added this to the 0.8.0 milestone on Oct 26, 2026
  2. 4 remaining items

  3. marked this as blocked by 15 issues on Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    frontendFrontend (React/TypeScript)testsTest code and test infrastructure

    Type

    Fields

    Priority

    P3 - Low

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions