fix convex-test Date returns#291
Merged
Merged
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🐛 Fixes #96
🟢 95-100% confidence
bun run vitest run convex/orm/mutations.test.ts -t "should allow returning hydrated Date values from t.run in convex-test"failed with Convex rejecting.createdAtas a nativeDate.bun run vitest run convex/orm/mutations.test.ts; 🟢bun typecheck; 🟢bun lint:fix; 🟢bun check; 🟢 autoreview P2 fixed, P3 rejected by repo staging policy.✅ Outcome
Returning ORM-hydrated timestamp fields from
convexTest().run()no longer crashes the test helper. Dates are converted to Convex-safe millisecond numbers beforeconvex-testserializes the callback result.This PR includes the unrelated
.tmp/better-auth-oom-latestscratch app because the repo instruction for PRs says to stage all modified and untracked files, even unrelated ones. That is noisy, but it is deliberate policy compliance.🏗️ Design
The fix lives at the repo
convexTestwrapper boundary, not in production ORM hydration. The walker only recurses through arrays and Convex-simple/plain objects, leaving unsupported class instances untouched so Convex still rejects invalid return values.🧪 Verified
bun run vitest run convex/orm/mutations.test.ts -t "should allow returning hydrated Date values from t.run in convex-test"red before fix, green after fixbun run vitest run convex/orm/mutations.test.ts -t "hydrated Date values|unsupported class returns|nullable timestamp columns"bun run vitest run convex/orm/mutations.test.tsbun typecheckbun lint:fix.agents/skills/autoreview/scripts/autoreview --mode local --parallel-tests "bun run vitest run convex/orm/mutations.test.ts"bun check