Files
hanzo.ai/e2e/unit/menu.spec.ts
zeekay 75e4ba9102 Every page's first load sheds the palette, the toaster and the menus' copy
What the site's header and root mount on every page carried three things no
page draws until the reader acts:

- The header's Solutions and Hanzo OS rows imported lib/data/solutions.ts and
  lib/layers.ts whole, every solution's page copy and every layer's
  operations, to draw a column of links that is not open. The rows are now
  derived at prebuild (scripts/sync-menu.mjs → lib/data/menu.json: names and
  addresses), so a solution or a layer is still added in its list and nowhere
  else; e2e/unit/menu.spec holds the file to the lists.
- The ⌘K palette and the toast viewport load once React owns the page
  (components/shell/later.tsx): the palette listens for its own chord, and a
  toast is always something the reader did after the page was theirs.
  components/shell/lazy.ts names one export of each package, so the import
  takes them and not the barrels.

An empty page's first load is 354 KB (was 367), the landing's 430 KB gzip
against weight.spec's 445 (was 457), and the pages over perf.budget.json go
from 124 to 64.

Claude-Session: https://claude.ai/code/session_01BLLMyBFSvAfCt7ZGqYuiEz
2026-10-22 13:05:18 -07:00

17 lines
690 B
TypeScript

import { test, expect } from '@playwright/test'
import { menu } from '../../scripts/sync-menu.mjs'
import kept from '../../lib/data/menu.json' with { type: 'json' }
/**
* THE HEADER'S SOLUTIONS AND HANZO OS ROWS ARE THE LISTS' OWN.
*
* The nav tree reads lib/data/menu.json, written at prebuild from
* lib/data/solutions.ts and lib/layers.ts (scripts/sync-menu.mjs), so the
* header ships names and addresses and not every solution's page copy. The
* committed file is held to the lists, so a solution added there and not
* synced fails here rather than missing from the menu.
*/
test('menu.json is what the solutions and the layers say', () => {
expect(kept).toEqual(menu())
})