fix(test): mock db to handle sql count(*) queries (GRO-1917) #102

Merged
Flea Flicker merged 2 commits from fix/GRO-1914-seed-typeof into dev 2026-05-29 16:36:41 +00:00
Member

Summary

  • Fix petProfileSummary test mock to properly handle Drizzle sql template tag with count(*) queries
  • The previous mock's sql function returned a plain string instead of a Drizzle SQL object with .as() method
  • Also adds Symbol.asyncIterator to makeChainable for for await...of patterns

Root Cause

The sql\count(*)::int`.as("count")pattern used in pets.ts required the mock'ssqlto return an object with an.as(alias)method. The old mock returned just the raw string, causing all count queries to fall through to raw appointment rows and returnundefinedforvisitCount`.

Test plan

  • All 538 tests pass locally
  • CI run triggered by this PR validates the fix
## Summary - Fix petProfileSummary test mock to properly handle Drizzle `sql` template tag with `count(*)` queries - The previous mock's `sql` function returned a plain string instead of a Drizzle SQL object with `.as()` method - Also adds `Symbol.asyncIterator` to `makeChainable` for `for await...of` patterns ## Root Cause The `sql\`count(*)::int\`.as("count")` pattern used in pets.ts required the mock's `sql` to return an object with an `.as(alias)` method. The old mock returned just the raw string, causing all count queries to fall through to raw appointment rows and return `undefined` for `visitCount`. ## Test plan - [x] All 538 tests pass locally - [x] CI run triggered by this PR validates the fix
Flea Flicker added 2 commits 2026-05-29 16:34:51 +00:00
fix(seed): use typeof on enum.enumValues for db build
CI / Test (pull_request) Successful in 10s
CI / Lint & Typecheck (pull_request) Successful in 14s
CI / Build & Push Docker Images (pull_request) Successful in 51s
4df7d96020
TS2749: enumValues is a value, not a type — wrap with typeof before
indexing.

Also extends Lint & Typecheck CI job to run pnpm --filter @groombook/db
typecheck so this class of error is caught at lint time rather than
Docker build time.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
fix(test): mock db to handle sql count(*) queries and async iteration
CI / Test (pull_request) Successful in 13s
CI / Lint & Typecheck (pull_request) Successful in 16s
CI / Build & Push Docker Images (pull_request) Successful in 1m13s
bf064b3ada
The petProfileSummary mock's sql tag returned a plain string instead of
a proper Drizzle SQL object, so count(*) queries via .as("count") failed.
Also added Symbol.asyncIterator support for for-await-of patterns used
in the pets router.

Fixes: GRO-1917

Co-Authored-By: Paperclip <noreply@paperclip.ing>
Flea Flicker merged commit b5f964c1ff into dev 2026-05-29 16:36:41 +00:00
Sign in to join this conversation.