Test suites breakdown
Every test runner KA26 uses, what each one covers, where the files live.
Marketplace root suite (Vitest, npm test)
Total: 2668 tests, all green as of 2026-05-01.
Lives in /Users/.../marketplace/tests/. Run via npm test from the marketplace repo root. Uses Vitest with Node environment by default; // @vitest-environment jsdom directive in any file under tests/components/ switches to jsdom for that file only.
What's actually inside the 2668
| Bucket | Approx count | What it covers | Examples |
|---|---|---|---|
| Web app file-shape | ~1100 | Next.js routes, src/lib/*, src/components/* | analytics-events.test.ts, api-shape-contracts.test.ts, app-isolation.test.ts |
| Cross-app contracts | ~800 | Reads mobile/, mobile-seller/, mobile-doctor/ source as text | mobile-code-integrity.test.ts (189 tests for consumer mobile), seller-bid-lifecycle.test.ts (68 tests for seller bid screen) |
| API integration | ~300 | Hits real Next.js API routes (mocked DB or live) | api-method-coverage.test.ts, auth-gates-regression.test.ts |
| Schema / DB | ~80 | Reads prisma/schema.prisma as text + some live DB pings | db-pool.test.ts |
| jsdom component integration | ~30 | Real React mount, simulated clicks | tests/components/SellerNotificationToast.test.tsx, VoiceRecorder.test.tsx |
| Skipped / pending | 231 | Mostly Eats (decommissioned 2026-04-17) + flaky integration tests |
Key files (worth knowing by name)
| File | What it pins |
|---|---|
tests/analytics-events.test.ts | Every event in the EventType union + every track() call site |
tests/seller-bid-lifecycle.test.ts | All seller-side bid behavior (BUG-006a/b/c/d/e + BUG-007). 68 tests. |
tests/voice-search.test.ts | Voice search Sarvam pipeline contract |
tests/voice-format-and-routing.test.ts | BUG-003 (audio format) + BUG-004 (intent routing) |
tests/regional-search.test.ts | BUG-005 (Kannada/Hindi transliteration) |
tests/app-isolation.test.ts | The 4 auth surfaces (consumer/seller/doctor/delivery) never cross-import |
tests/build-integrity.test.ts | Next.js build doesn't fail (~500 cheap structural checks) |
tests/admin-dashboard.test.ts | 139 tests — every admin screen + action |
tests/post-deploy-smoke.test.ts | 30 tests — runs against PROD after every deploy |
Mobile consumer suite (cd mobile && npm test)
Jest + React Native Testing Library. Lives in mobile/__tests__/.
Current state: 422 pass / 9 pre-existing fail / 12 skipped (443 total).
The 9 failures are all in tests/api-integration.test.ts and api-response-shapes.test.ts — they hit /api/restaurants which was decommissioned 2026-04-17. The data was preserved for archival but the endpoint isn't extended anymore. These tests need to be deleted; they remain because nobody has done it yet.
What it covers
mobile-code-integrity.test.ts— 189 file-shape tests on the mobile sources (parallel to the marketplace-root version). This file actually lives in BOTH suites for now.screen-completeness.test.ts— 72 tests checking all screens exist + handle empty stateui-consistency.test.ts— 54 tests on COLORS, design tokens, typographyapi-endpoints-auth.test.ts— 35 tests hitting prod APIs with various auth tokenspost-deploy-smoke.test.ts— 30 tests__tests__/unit/NegotiationCard.test.tsx,MyBidsScreen.test.tsx,ProductDetailNegotiation.test.tsx— bid UI mounting tests
Mobile seller suite (cd mobile-seller && npm test)
Jest. Lives in mobile-seller/__tests__/.
Current state: 86 pass / 5 pre-existing fail / 91 total.
The 5 failures are in earnings/home/orders integration tests and are pre-existing (broken before any of the 2026-04 to 2026-05 work). They depend on prod DB state that has changed.
Key files
__tests__/components/SellerOffersScreen.test.tsx— render-mount sanity for the bids inbox. Covers regression class "hooks-after-early-return crash" + counter modal interaction.__tests__/integration/orders.test.tsx— pre-existing failures here, not from our work__tests__/integration/profile.test.tsx— passes when run alone, fails in parallel run (test pollution)
Mobile doctor suite (cd mobile-doctor && npm test)
Rarely run. Doctor flow has been deprioritized — see project_prescription_deprioritized.md in the personal memory.
Live e2e smoke (hourly cron)
Lives in .github/workflows/health-check.yml. Runs every hour at :17 past.
| What it tests | File |
|---|---|
/api/health returns 200 | inline curl |
| End-to-end smoke (browse → product → cart) | tests/e2e-smoke.test.ts |
| Signup smoke (create + verify + delete throwaway user) | tests/e2e-signup-smoke.test.ts |
| Critical funnel smoke | tests/e2e-critical-funnels-smoke.test.ts |
| SSL cert expiry check | inline openssl |
Failures email myotpservice25@gmail.com. Created after the 6-day [object Object] registration outage — the lesson is that file-shape tests are necessary but never sufficient.
CI behavior
| Workflow | When | What |
|---|---|---|
.github/workflows/deploy.yml | Push to main | Runs npm test (the full 2668), then gcloud builds submit, then gcloud run deploy. A failure here aborts the deploy. |
.github/workflows/health-check.yml | Every hour at :17 | Hits prod API + runs the 4 e2e smoke files |
Adding a test
The full pattern is in Writing tests. Quick rules:
- Most tests should be layer-1 file-shape (cheap, fast, catches accidental deletion)
- New UI components → also add layer-2 component integration (
tests/components/Foo.test.tsx) - Backend changes → add layer-4 live verification recipe to your PR description (so the next person can re-run it)
- Don't bypass the rule: every new feature needs a contract test BEFORE the code lands. Prevents "I'll add a test later" tech debt.