Files
orangecat/tests
4b4ac98231 fix(nav): the sidebar section label was not a control (#840)
* fix(nav): the sidebar section label was not a control

Clicking "Fund" / "Coordinate" / "Finance" did nothing — the label was an
<h3> in a <div> and only the small chevron beside it carried the onClick.
Three defects in the same family, all of them "the click did nothing":

1. The whole header row is now one <button>. A word that looks like a
   control but isn't reads as a dead click, and the arrow alone was a 44px
   target inside a full-width row of affordance. Second time this class
   landed in this sidebar (see ContextSwitcher, "not a dead pixel"), so it
   gets a guard rather than a third fix.

2. Collapsing the section holding the active page was a visual no-op: the
   render gate was `!isCollapsed || hasActiveItem`, so the chevron flipped
   to > while the list stayed open. An explicit toggle now wins.

3. Expanding every section silently reverted on reload — an empty saved set
   was read as "nothing was ever saved" and replaced by the defaults. Key
   presence, not set size, now decides.

Also removes an SSOT violation found next door: buildInitialCollapsedSections
branched on viewport (`isMobile ? section.priority > 3 : ...`), so on a phone
the declared `defaultExpanded` was ignored in favour of a bare magic number
and the same account saw different sections open on phone than on laptop.
`defaultExpanded` is now the only input — which does mean Create and Fund
start collapsed on mobile, matching the generator's documented intent.

5 tests, each verified by reverting the source and confirming it fails.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XeELB8b3N4JrT2asYL9WvE

* chore(ci): gate the dead-label shape instead of fixing it a third time

A heading sitting BESIDE a chevron-only toggle is a dead click: the visitor
aims at the word and nothing happens, while the only real target is a small
arrow in a full-width row of apparent affordance.

This shape has now been reported twice in this one sidebar — on the
ContextSwitcher avatar (two separate visitors, see its test's header) and on
the Fund / Coordinate / Finance section headers, fixed in the previous
commit. Per the never-twice rule the third occurrence should be impossible,
not cheap, so the class gets a check rather than another sweep.

check:dead-labels scans src/components for a heading followed within 12 lines
by a <button> containing a Chevron, with no heading inside that button. The
correct shape — label INSIDE the control, which HeaderNavigation already
does — does not trip it. Zero hits across src/components today, so the
sidebar was the last one.

Mutation-proven both ways: restoring the pre-fix SidebarNavigation makes it
exit 1 naming that exact line, and the current tree exits 0. A gate that has
never been shown to fail is not a gate.

Note for the fleet: this covers AUTHED surfaces, which the central
ui-defect-audit.mjs structurally cannot reach — it renders public entry pages
only. The two are complementary, not duplicates.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XeELB8b3N4JrT2asYL9WvE

---------

Co-authored-by: Georgy Butaev <41178744+g-but@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 11:42:37 +02:00
..

Tests Directory

This directory contains all test files organized by type and purpose.

Directory Structure

  • auth/ - Authentication-related tests
  • e2e/ - End-to-end tests using Playwright
  • manual/ - Manual testing scripts and utilities
  • security/ - Security-focused tests
  • setup/ - Test setup and configuration

Test Types

  • Unit Tests: Located in __tests__/ directories next to source files
  • Integration Tests: API and service integration tests
  • E2E Tests: Full user journey tests using Playwright
  • Security Tests: Security vulnerability and policy tests
  • Manual Tests: Scripts for manual testing scenarios

Running Tests

# All tests
npm test

# Unit tests only
npm run test:unit

# Integration tests
npm run test:integration

# E2E tests
npm run test:e2e

# Security tests
npm run test:security

# Auth tests
npm run test:auth

Test Configuration

  • jest.config.js - Jest configuration
  • playwright.config.ts - Playwright E2E configuration
  • setup.ts - Global test setup
  • TestWrapper.tsx - React testing utilities