fix(test): mock db to handle sql count(*) queries (GRO-1917) #102
Reference in New Issue
Block a user
Delete Branch "fix/GRO-1914-seed-typeof"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
sqltemplate tag withcount(*)queriessqlfunction returned a plain string instead of a Drizzle SQL object with.as()methodSymbol.asyncIteratortomakeChainableforfor await...ofpatternsRoot 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
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>