belviskhoremk 72fa3e0f90 docs: fix plan's Task 7-9 test mocking approach
Task 3's review surfaced that the plan's original vi.importActual-based
mocking for Shop.test.tsx/Home.test.tsx/Book.test.tsx would execute the
real data-layer modules, which import the real Supabase client and
construct it at module-load time via createClient(VITE_SUPABASE_URL,
...) -- throwing "supabaseUrl is required" in a test env with no .env
file, before the test even runs.

Switched all three to mock ../lib/supabase directly instead, matching
the pattern Task 3's own products.test.ts already uses successfully.
Also fixed 3 occurrences of `err instanceof Error ? err.message :
String(err)` in the planned Shop.tsx/Home.tsx/Book.tsx error handling
-- fetchProducts/fetchServices throw the raw Postgrest error object
(not necessarily an Error instance), so this would have rendered
"[object Object]" instead of the real message in the mocked test
scenario.

Claude-Session: https://claude.ai/code/session_01NhxA4npAXAxmCDEJt6kxSH
2026-08-12 20:09:10 +02:00
2026-08-12 12:52:25 +02:00

Braids by Mira

Public marketing site for Braids by Mira — landing page, product showcase, booking flow, and salon policies.

Scripts

  • npm run dev — start the local dev server
  • npm test (or npx vitest run) — run the frontend test suite
  • npm run build — type-check and build for production
  • npm run lint — run ESLint
  • npm run test:functions — run the Deno tests for the Edge Functions' shared email builders (requires Deno installed)
  • npm run seed — seed products, services, and the default schedule into a Supabase project (see below)

Backend (Supabase)

The backend lives in supabase/ — Postgres schema/RLS migrations, pgTAP tests, and Deno Edge Functions for booking/inquiry email notifications.

  • npx supabase start — start the local Docker-based Supabase dev stack (Postgres, Studio, Auth, Storage, Edge Functions runtime). Requires Docker.
  • npx supabase db reset — replay all migrations from scratch against the local database.
  • npx supabase test db — run the pgTAP test suite in supabase/tests/database/ against the local database.

Environment variables

Copy .env.example to .env.local and fill in:

  • VITE_SUPABASE_URL, VITE_SUPABASE_ANON_KEY — frontend Supabase client config (exposed to the browser).
  • SUPABASE_URL, SUPABASE_SERVICE_ROLE_KEY — used only by scripts/seed.ts (server-side, never expose the service role key to the browser). These are distinct from the VITE_-prefixed frontend variables above.
Description
No description provided
Readme 3.9 MiB
Languages
TypeScript 77.5%
PLpgSQL 14.6%
CSS 7.1%
HTML 0.5%
JavaScript 0.3%