Skip to content

Add component tests for VisualizationSwitcher #108

Description

@williamthorsen

Description

VisualizationSwitcher.tsx toggles between the factory (Excalibur GameCanvas) and flow diagram (React Flow FlowDiagram) views. It is the primary rendering path in App.tsx.

Core tests already exist (7 tests covering switching behavior, active-button styling, and URL param integration). Two gaps remain:

  1. Status prop forwarding is untested: The mocks render static <div> elements that ignore all props, so there is no verification that status reaches the child component.
  2. No shared mock setup: GameCanvas/FlowDiagram mocks are defined inline in the test file. A shared module would let other test files (e.g., App.test.tsx) reuse them.

Key files

  • Component: packages/factory/src/client/components/VisualizationSwitcher.tsx
  • Existing tests: packages/factory/src/client/components/__tests__/VisualizationSwitcher.test.tsx
  • Test helpers: packages/factory/src/__test-helpers__/fixtures.ts

Acceptance criteria

Must have (already met)

  • React Testing Library tests covering: default view renders factory, clicking "Flow" switches to flow diagram, clicking "Factory" switches back
  • Appropriate mocks for GameCanvas (Excalibur) and FlowDiagram (React Flow) dependencies

Should have

  • Tests verify that the correct component receives the status prop

Nice to have

  • Shared mock setup in __test-helpers__/ reusable by other component tests

Part of

#57

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions