WFDASH-WEBAPP/src/lib/server
Dave 7986784eaf chore(tests): fix ~60 pre-existing TS errors across 11 test files
Typecheck cleanup after the deploy blocker push — `tsc --noEmit` was
silent on `d11a184` baseline but ~60 errors hid across test files
that only the compiler surfaces (the build was clean because test
files are excluded from the prod bundle). Touched:

- src/app/api/mcp/route.test.ts (16) — generic on `vi.fn()` for
  tuple inference; `as unknown as` two-step cast on record literals
- src/app/api/mcp/po-agent-workflow.test.ts (1) — spread instead of
  duplicate key
- src/components/buyer-tasks/buyer-task-group-card.test.tsx (5) —
  `PurchaseOrderEmailPayload` now requires `subject`/`body`
- src/components/collection-confirm/confirm-stock-dialog.test.tsx (1)
  — removed shadowed `id` from `makeRow` overrides
- src/components/item-intel-popover.test.tsx (2) — missing row
  fields + boolean→object for `verified`
- src/components/quotes/process-item-card.test.tsx (2) — full
  QuoteItem stub; generic on `vi.fn()`
- src/components/sprint-item-pricing-modal.test.tsx (3) — full
  SprintItem/QuoteItemAttachment/QuoteAttachment stubs
- src/lib/server/orders-service-review.test.ts (~60) — annotated
  `getOne` return type to break union widening on the expand option
- src/lib/server/orders-service.test.ts (2) — removed bogus
  `includeArchivedCounts` param; `rfq_number` now whitelisted on Order
- src/lib/server/quotes-service.test.ts (3) — two-step cast on
  Quote header; `unit?` now on QuoteItem
- src/lib/server/stock-purchase-items-service.test.ts (~10) — typed
  `pbMock` via `StockPurchaseItemsPb` so `*WithPb(pb,...)` checks

Also added two optional fields to `src/lib/types.ts`:
- `QuoteItem.unit?` — pre-2026 rows have no unit, so it's optional
- `Order.rfq_number?` — populated by the n8n email agent, inherited
  verbatim by `splitOrder`

Build: clean. Typecheck: 0 errors. Tests: 14 pre-existing runtime
failures + 1 pre-existing unhandled error in `supplier-form.test.tsx`
remain — confirmed they exist on `d11a184` baseline, so they are
outside the cleanup scope and unchanged by this commit.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-27 04:43:40 +02:00
..
agent-auth.test.ts
agent-auth.ts
ai-settings-service.ts
ai-system-prompt.ts
attachment-extractor.ts
browser-session.ts
buyer-tasks-service.test.ts feat(quotes): enhance scoring logic to include price matching 2026-08-24 07:09:39 +02:00
buyer-tasks-service.ts feat(quotes): enhance scoring logic to include price matching 2026-08-24 07:09:39 +02:00
collection-confirm-service.test.ts feat(collection-confirm): update stock item filtering logic in listCollectedItems 2026-08-17 08:27:36 +02:00
collection-confirm-service.ts feat(collection-confirm): update stock item filtering logic in listCollectedItems 2026-08-17 08:27:36 +02:00
collection-confirm-upload.test.ts
completed-window.test.ts feat(quotes): enhance scoring logic to include price matching 2026-08-24 07:09:39 +02:00
counter-service.ts
customers-service.test.ts
customers-service.ts
dashboard-service.test.ts
dashboard-service.ts
deliveries-service.test.ts feat(deliveries): enhance delivery notes management and UI 2026-08-17 01:27:03 +02:00
deliveries-service.ts feat(deliveries): enhance delivery notes management and UI 2026-08-17 01:27:03 +02:00
delivery-notes-service.test.ts feat(orders): enhance order handling with email_message_id deduplication and displayContactName utility 2026-08-21 19:18:02 +02:00
delivery-notes-service.ts feat(orders): enhance order handling with email_message_id deduplication and displayContactName utility 2026-08-21 19:18:02 +02:00
driver-stops.ts feat(delivery-notes): standardize delivery-note letterhead across PDFs 2026-08-18 11:53:25 +02:00
item-history-service.test.ts
item-history-service.ts
item-intel-service.ts
management-service.ts
mcp-upstream-fetch.test.ts
mcp-upstream-fetch.ts
order-completion.test.ts
order-completion.ts
order-item-context-service.test.ts
order-item-context-service.ts
order-item-margin-approval-service.test.ts
order-item-margin-approval-service.ts
order-item-status.test.ts
order-item-status.ts
order-items-service.test.ts feat(order-splitting): enhance order item splitting functionality and error handling 2026-08-17 14:14:27 +02:00
order-items-service.ts feat(order-splitting): enhance order item splitting functionality and error handling 2026-08-17 14:14:27 +02:00
order-quote-match.test.ts
order-quote-match.ts
orders-service-review.test.ts chore(tests): fix ~60 pre-existing TS errors across 11 test files 2026-08-27 04:43:40 +02:00
orders-service.test.ts chore(tests): fix ~60 pre-existing TS errors across 11 test files 2026-08-27 04:43:40 +02:00
orders-service.ts feat(quotes): enhance scoring logic to include price matching 2026-08-24 07:09:39 +02:00
po-email-template.ts
po-number.test.ts
po-number.ts
pocketbase-admin.test.ts
pocketbase-admin.ts
price-list-match.test.ts
price-list-match.ts
price-list-service.test.ts
price-list-service.ts
purchase-order-agent-service.test.ts
purchase-order-agent-service.ts
purchase-orders-service.test.ts
purchase-orders-service.ts
quote-email-template.ts
quote-items-insights-service.test.ts
quote-items-insights-service.ts
quote-items-service.test.ts
quote-items-service.ts
quotes-ai-processor.ts
quotes-from-email-service.ts
quotes-search-service.test.ts feat(quotes): enhance scoring logic to include price matching 2026-08-24 07:09:39 +02:00
quotes-search-service.ts feat(quotes): enhance scoring logic to include price matching 2026-08-24 07:09:39 +02:00
quotes-service.test.ts chore(tests): fix ~60 pre-existing TS errors across 11 test files 2026-08-27 04:43:40 +02:00
quotes-service.ts feat(quotes): finish createQuote refactor for operator-supplied quote_number 2026-08-27 04:19:51 +02:00
repairs-service.ts fix(repair-details): update file handling and type definitions 2026-08-21 01:13:44 +02:00
stock-booking-service.test.ts
stock-booking-service.ts
stock-cost-service.ts
stock-items-service.test.ts
stock-items-service.ts
stock-out.ts
stock-purchase-invoice-matching-service.test.ts
stock-purchase-invoice-matching-service.ts
stock-purchase-items-service.test.ts chore(tests): fix ~60 pre-existing TS errors across 11 test files 2026-08-27 04:43:40 +02:00
stock-purchase-items-service.ts feat(collection-confirm): add quantity collection handling and deduplication improvements 2026-08-17 02:17:27 +02:00
stock-purchases-migration.test.ts
stock-purchases-service.attachments.test.ts
stock-purchases-service.test.ts
stock-purchases-service.ts
stock-quick-draft-service.test.ts
stock-quick-draft-service.ts
stock-surplus.test.ts
stock-surplus.ts
tv-dashboard-service.ts feat(tv-dashboard): enhance TV dashboard with driver stops and performance metrics 2026-08-19 10:16:49 +02:00
tv-session.ts