Skip to content

Convert the test support files to TypeScript and add installBridge #297

Closed

Description

@jtklein-agents

Parent

#295

What to build

The test support files in src/test/ are TypeScript, and one helper there, installBridge, is the only code that writes to window.rendererBridge. A test hands it a Partial<RendererBridge>, so tsc checks every bridge method a test supplies, and a test that stubs a method the renderer bridge no longer has fails the typecheck.

  • installBridge takes Partial<RendererBridge> and holds the only cast to the full type.
  • It keeps the existing rule: the test's bridge is merged onto the one default bridge object the setup installed. It does not replace that object, and it does not spread or read host.
  • stubBridge takes the same type and calls installBridge.

This ticket does not touch the other tests: each later conversion ticket replaces the direct bridge assignments in its own files.

Acceptance criteria

  • The five support files (the bridge setup, the MobX action-warning check, the store bridge helpers, the electron and Sentry stand-ins) are .ts: a pure rename commit (git mv, R100), then a typing commit, with yarn react-test passing after each. The Vitest config points at the new names.
  • installBridge exists in src/test/ with the behaviour above, and within src/test/ it is the only code that writes to window.rendererBridge.
  • A small test of installBridge's external behaviour: after the call, the page sees the supplied methods on the same default bridge object, and the defaults the setup stubs are still there.
  • The existing stubBridge test and the MobX action-warning proof test still pass.
  • The support files have zero diagnostics under --noImplicitAny, with no @ts-nocheck or @ts-ignore, and nothing is added to the typecheck baseline.
  • The test count of every existing file is unchanged; the pull request states the counts and the new installBridge tests.
  • yarn lint, yarn typecheck:baseline and yarn react-test pass.

Agent-doc edit (driving dev, main checkout, when this merges)

  • CODING_STANDARDS.md: the stubBridge and track rule names src/test/storeBridge.ts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions