-
-
Notifications
You must be signed in to change notification settings - Fork 13
test: add edge-runtime e2e #458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughAdds a new edge-runtime test package (schema, generated types, tests, tooling), simplifies Bun runtime schemas/tests by removing shared CommonFields/Role/timestamps/meta/content, updates Bun test teardown to disconnect clients, and broadens Vitest test discovery globs. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Claude finished @ymc9's task —— View job I'll review this pull request that adds edge-runtime e2e tests. Let me analyze the changes systematically. Review Tasks
Code Review SummaryThe PR successfully adds edge-runtime e2e testing capabilities alongside the existing bun tests. The implementation follows established patterns and maintains consistency across runtime environments. ✅ StrengthsTest Structure & Organization:
Test Coverage:
Code Quality:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (2)
tests/runtimes/edge-runtime/scripts/generate.ts (2)
16-18: Unnecessaryasynckeyword.The
generatefunction is markedasyncbut only contains synchronousexecSynccode. Either removeasyncor consider usingexecwith promises for truly async execution.-async function generate(schemaPath: string) { +function generate(schemaPath: string) { execSync('bunx --bun zen generate', { cwd: path.dirname(schemaPath) }); }
8-14: Consider adding error handling for generation failures.If
execSyncfails for one schema, the script will crash without processing remaining schemas. Consider wrapping in try-catch if you want to report all failures at once.async function main() { const zmodelFiles = [...glob.sync(path.resolve(dir, '../schemas/*.zmodel'))]; + const errors: string[] = []; for (const file of zmodelFiles) { console.log(`Generating TS schema for: ${file}`); - await generate(file); + try { + generate(file); + } catch (e) { + errors.push(`Failed to generate ${file}: ${e}`); + } } + if (errors.length > 0) { + throw new Error(errors.join('\n')); + } }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (14)
tests/runtimes/bun/bun-e2e.test.ts(0 hunks)tests/runtimes/bun/schemas/models.ts(1 hunks)tests/runtimes/bun/schemas/schema.ts(0 hunks)tests/runtimes/bun/schemas/schema.zmodel(1 hunks)tests/runtimes/edge-runtime/edge-runtime-e2e.test.ts(1 hunks)tests/runtimes/edge-runtime/package.json(1 hunks)tests/runtimes/edge-runtime/schemas/input.ts(1 hunks)tests/runtimes/edge-runtime/schemas/models.ts(1 hunks)tests/runtimes/edge-runtime/schemas/schema.ts(1 hunks)tests/runtimes/edge-runtime/schemas/schema.zmodel(1 hunks)tests/runtimes/edge-runtime/scripts/generate.ts(1 hunks)tests/runtimes/edge-runtime/tsconfig.json(1 hunks)tests/runtimes/edge-runtime/vitest.config.ts(1 hunks)vitest.config.ts(1 hunks)
💤 Files with no reviewable changes (2)
- tests/runtimes/bun/bun-e2e.test.ts
- tests/runtimes/bun/schemas/schema.ts
🧰 Additional context used
📓 Path-based instructions (1)
**/*.zmodel
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.zmodel: Always runzenstack generateafter modifying ZModel schemas
ZModel schema files should define database structure and policies that compile to TypeScript viazenstack generate
Files:
tests/runtimes/edge-runtime/schemas/schema.zmodeltests/runtimes/bun/schemas/schema.zmodel
🧠 Learnings (9)
📓 Common learnings
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to tests/e2e/**/*.{ts,tsx} : E2E tests should validate real-world schema compatibility with established projects
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to packages/zenstackhq/orm/**/*.test.{ts,tsx} : ORM package tests should include comprehensive client API tests and policy tests
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to tests/**/type*.{ts,tsx} : Ensure TypeScript inference and type coverage are validated through type coverage tests
Applied to files:
tests/runtimes/edge-runtime/tsconfig.jsonvitest.config.ts
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to tests/e2e/**/*.{ts,tsx} : E2E tests should validate real-world schema compatibility with established projects
Applied to files:
tests/runtimes/edge-runtime/tsconfig.jsontests/runtimes/edge-runtime/package.jsonvitest.config.tstests/runtimes/edge-runtime/edge-runtime-e2e.test.tstests/runtimes/edge-runtime/scripts/generate.tstests/runtimes/bun/schemas/models.tstests/runtimes/edge-runtime/schemas/schema.tstests/runtimes/edge-runtime/schemas/models.tstests/runtimes/edge-runtime/schemas/input.ts
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to **/*.zmodel : ZModel schema files should define database structure and policies that compile to TypeScript via `zenstack generate`
Applied to files:
tests/runtimes/edge-runtime/tsconfig.jsontests/runtimes/edge-runtime/scripts/generate.tstests/runtimes/edge-runtime/schemas/schema.zmodeltests/runtimes/bun/schemas/models.tstests/runtimes/edge-runtime/schemas/schema.tstests/runtimes/edge-runtime/schemas/models.tstests/runtimes/edge-runtime/schemas/input.tstests/runtimes/bun/schemas/schema.zmodel
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to packages/zenstackhq/orm/**/*.test.{ts,tsx} : ORM package tests should include comprehensive client API tests and policy tests
Applied to files:
tests/runtimes/edge-runtime/edge-runtime-e2e.test.tstests/runtimes/edge-runtime/schemas/input.ts
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to packages/zenstackhq/orm/**/*.{ts,tsx} : Implement plugin hooks at ORM, Kysely, and entity mutation levels for query interception and customization
Applied to files:
tests/runtimes/edge-runtime/edge-runtime-e2e.test.tstests/runtimes/bun/schemas/models.tstests/runtimes/edge-runtime/schemas/schema.tstests/runtimes/edge-runtime/schemas/models.ts
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to **/*.zmodel : Always run `zenstack generate` after modifying ZModel schemas
Applied to files:
tests/runtimes/edge-runtime/scripts/generate.tstests/runtimes/edge-runtime/schemas/schema.zmodel
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to packages/zenstackhq/orm/**/*.{ts,tsx} : Use Kysely as the query builder interface for low-level database queries, avoiding raw SQL when possible
Applied to files:
tests/runtimes/bun/schemas/models.tstests/runtimes/edge-runtime/schemas/schema.tstests/runtimes/edge-runtime/schemas/models.tstests/runtimes/edge-runtime/schemas/input.ts
📚 Learning: 2025-10-21T16:09:31.218Z
Learnt from: ymc9
Repo: zenstackhq/zenstack-v3 PR: 319
File: packages/runtime/src/client/executor/zenstack-query-executor.ts:63-72
Timestamp: 2025-10-21T16:09:31.218Z
Learning: In ZenStack, TypeDefs can be inherited by models. When a TypeDef contains fields with `map` attributes, those mapped field names need to be processed by the QueryNameMapper since they become part of the inheriting model's schema. Therefore, when checking if a schema has mapped names (e.g., in `schemaHasMappedNames`), both `schema.models` and `schema.typeDefs` must be inspected for `@map` and `map` attributes.
Applied to files:
tests/runtimes/bun/schemas/models.tstests/runtimes/edge-runtime/schemas/schema.ts
🧬 Code graph analysis (2)
tests/runtimes/edge-runtime/scripts/generate.ts (1)
packages/cli/src/utils/exec-utils.ts (1)
execSync(7-16)
tests/runtimes/edge-runtime/schemas/schema.ts (3)
packages/schema/src/expression-utils.ts (1)
ExpressionUtils(19-123)packages/schema/src/schema.ts (1)
SchemaDef(11-19)tests/runtimes/bun/schemas/schema.ts (1)
schema(103-103)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Agent
- GitHub Check: build-test (20.x, postgresql)
- GitHub Check: build-test (20.x, sqlite)
- GitHub Check: claude-review
🔇 Additional comments (12)
tests/runtimes/bun/schemas/models.ts (1)
1-11: LGTM!The auto-generated models file correctly reflects the simplified schema with only
UserandPosttype exports. The import structure is clean and follows the expected pattern for ZenStack-generated code.tests/runtimes/bun/schemas/schema.zmodel (1)
1-31: Schema structure looks good.The simplified schema is well-structured for e2e testing purposes:
- User and Post models have proper field definitions with appropriate defaults
- Access policies correctly test authentication-based access control
- The relation between Post and User with cascade delete/update is appropriate
As per coding guidelines, ensure
zenstack generateis run after any modifications to this schema to regenerate the TypeScript types.vitest.config.ts (1)
5-5: LGTM!The recursive glob patterns correctly enable discovery of nested test projects like the new edge-runtime tests.
tests/runtimes/edge-runtime/vitest.config.ts (1)
1-11: LGTM!Clean configuration that properly extends the base config and sets the edge-runtime test environment.
tests/runtimes/edge-runtime/schemas/models.ts (1)
1-11: LGTM!Auto-generated model types correctly correspond to the User and Post models defined in schema.zmodel.
tests/runtimes/edge-runtime/package.json (1)
1-26: LGTM!Package configuration is well-structured with appropriate dependencies for edge-runtime e2e testing. The use of
workspace:*for internal packages andcatalog:for pg follows monorepo best practices.tests/runtimes/edge-runtime/edge-runtime-e2e.test.ts (2)
10-38: Good CRUD test coverage.The test validates create, read (findUnique/findFirst), update, and delete operations with proper assertions. This aligns with the learning that e2e tests should validate real-world schema compatibility.
40-75: Excellent policy enforcement test.The test thoroughly validates access control by checking:
- Anonymous users see 0 posts (denied by
@@deny('all', auth() == null))- Post owner sees all 2 posts (allowed by
@@allow('all', auth().id == authorId))- Other authenticated users see only 1 published post (allowed by
@@allow('read', published))This aligns well with the learning that ORM tests should include policy tests.
tests/runtimes/edge-runtime/schemas/schema.zmodel (2)
1-31: Well-structured schema with clear access policies.The schema defines appropriate models and policies that align with the test expectations:
- User policies allow self-management and authenticated read access
- Post policies deny anonymous access, allow owner full access, and allow public read of published posts
This correctly implements the policy behavior validated in the e2e tests.
5-7: The plugin path resolves correctly. The relative path"../../../packages/plugins/policy"fromtests/runtimes/edge-runtime/schemas/correctly points topackages/plugins/policy, which exists and is properly structured. Whenzen generateruns from the schema directory during the build process, this relative path resolution works as intended. No changes needed.tests/runtimes/edge-runtime/schemas/schema.ts (1)
8-104: Generated edge schema structure and policies look solidThe User/Post model definitions, relations, and auth rules are coherent and minimal yet realistic for e2e edge-runtime coverage, and the branded
Schema/schemaexports follow the established pattern for runtime schemas. Since this file is CLI‑generated and type‑checked viasatisfies SchemaDef, it looks good to keep as‑is and drive any changes from the.zmodelsource instead.tests/runtimes/edge-runtime/schemas/input.ts (1)
8-50: Edge runtime input types correctly wired to the schemaThe User/Post argument and payload type aliases are consistently parameterized by the local schema and cover the full set of standard operations (find/create/update/delete/count/aggregate/groupBy). This matches the expected generated pattern and should give the edge-runtime e2e tests proper typing without needing manual edits.
|
Claude finished @ymc9's task —— View job Code Review of Edge-Runtime E2E TestsTodo List
Overall AssessmentThis PR successfully adds edge-runtime e2e testing capabilities to complement the existing bun runtime tests. The implementation follows established patterns and provides good test coverage for both basic CRUD operations and access control policies. ✅ StrengthsTest Structure & Organization
Code Quality
Configuration & Setup
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds edge-runtime e2e tests and restructures the test organization by moving runtime-specific tests into a new tests/runtimes/ directory structure. The main vitest configuration is updated to support nested test projects, enabling better organization of runtime-specific test suites.
Key Changes
- Added new edge-runtime e2e test suite to validate ZenStack behavior in edge runtime environments using Vitest with the edge-runtime environment
- Restructured bun tests from
tests/bun/totests/runtimes/bun/with simplified schemas - Updated root vitest config to use recursive glob patterns (
**) to discover nested vitest configurations
Reviewed changes
Copilot reviewed 14 out of 19 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| vitest.config.ts | Changed glob patterns from packages/* to packages/** and tests/* to tests/** to support nested vitest project configurations |
| tests/runtimes/edge-runtime/vitest.config.ts | Added vitest configuration for edge-runtime environment tests |
| tests/runtimes/edge-runtime/tsconfig.json | Added TypeScript configuration for edge-runtime tests (contains incorrect bun-types reference) |
| tests/runtimes/edge-runtime/scripts/generate.ts | Added schema generation script (uses bunx without bun dependency) |
| tests/runtimes/edge-runtime/schemas/*.zmodel | Added simplified schema definitions matching bun test schemas |
| tests/runtimes/edge-runtime/schemas/*.ts | Added auto-generated TypeScript schema files |
| tests/runtimes/edge-runtime/package.json | Added package configuration with @edge-runtime/vm dependency for vitest environment |
| tests/runtimes/edge-runtime/edge-runtime-e2e.test.ts | Added e2e tests for CRUD operations and policy enforcement in edge runtime |
| tests/runtimes/bun/* | Restructured bun tests with simplified schemas (removed enums, type definitions, and content field) |
| pnpm-lock.yaml | Updated lockfile to reflect new test structure and @edge-runtime/vm dependency |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
|
Claude finished @ymc9's task —— View job Code Review of Edge-Runtime E2E TestsReview Tasks
Overall AssessmentThis PR successfully adds edge-runtime e2e testing capabilities to complement the existing bun runtime tests. The implementation follows established patterns and provides good test coverage for both basic CRUD operations and access control policies. ✅ StrengthsTest Structure & Organization
Code Quality
Configuration & Setup
|
|
Claude finished @ymc9's task —— View job Code Review of Edge-Runtime E2E TestsReview Tasks
Overall AssessmentThis PR successfully adds edge-runtime e2e testing capabilities to complement the existing bun runtime tests. The implementation follows established patterns and provides good test coverage for both basic CRUD operations and access control policies. ✅ StrengthsTest Structure & Organization
Code Quality
Configuration & Setup
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
tests/runtimes/bun/bun-e2e.test.ts(3 hunks)tests/runtimes/edge-runtime/edge-runtime-e2e.test.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- tests/runtimes/edge-runtime/edge-runtime-e2e.test.ts
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to tests/e2e/**/*.{ts,tsx} : E2E tests should validate real-world schema compatibility with established projects
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to packages/zenstackhq/orm/**/*.test.{ts,tsx} : ORM package tests should include comprehensive client API tests and policy tests
Applied to files:
tests/runtimes/bun/bun-e2e.test.ts
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to packages/zenstackhq/orm/**/*.{ts,tsx} : Implement plugin hooks at ORM, Kysely, and entity mutation levels for query interception and customization
Applied to files:
tests/runtimes/bun/bun-e2e.test.ts
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to tests/e2e/**/*.{ts,tsx} : E2E tests should validate real-world schema compatibility with established projects
Applied to files:
tests/runtimes/bun/bun-e2e.test.ts
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to packages/zenstackhq/orm/**/*.{ts,tsx} : Use Kysely as the query builder interface for low-level database queries, avoiding raw SQL when possible
Applied to files:
tests/runtimes/bun/bun-e2e.test.ts
🧬 Code graph analysis (1)
tests/runtimes/bun/bun-e2e.test.ts (1)
packages/orm/src/client/contract.ts (1)
ClientContract(63-197)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: build-test (20.x, sqlite)
- GitHub Check: build-test (20.x, postgresql)
- GitHub Check: claude-review
🔇 Additional comments (1)
tests/runtimes/bun/bun-e2e.test.ts (1)
2-2: ImportingClientContractandafterEachaligns with the new teardown patternUsing
ClientContractfor the shareddbhandle and pulling inafterEachfrombun:testis a good fit for typing the client againstschemaand ensuring connections are closed between tests. No issues here.Also applies to: 7-7
|
Claude finished @ymc9's task —— View job Pull Request ReviewReview Tasks
Overall AssessmentThis PR successfully adds edge-runtime e2e testing capabilities to complement the existing bun runtime tests. The implementation follows established patterns and provides good test coverage for both basic CRUD operations and access control policies. ✅ StrengthsTest Structure & Organization
Code Quality
Configuration & Setup
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
tests/runtimes/edge-runtime/.DS_Storeis excluded by!**/.DS_Store
📒 Files selected for processing (3)
tests/runtimes/bun/bun-e2e.test.ts(3 hunks)tests/runtimes/edge-runtime/edge-runtime-e2e.test.ts(1 hunks)tests/runtimes/edge-runtime/scripts/generate.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- tests/runtimes/edge-runtime/scripts/generate.ts
- tests/runtimes/edge-runtime/edge-runtime-e2e.test.ts
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to tests/e2e/**/*.{ts,tsx} : E2E tests should validate real-world schema compatibility with established projects
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to packages/zenstackhq/orm/**/*.test.{ts,tsx} : ORM package tests should include comprehensive client API tests and policy tests
Applied to files:
tests/runtimes/bun/bun-e2e.test.ts
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to tests/e2e/**/*.{ts,tsx} : E2E tests should validate real-world schema compatibility with established projects
Applied to files:
tests/runtimes/bun/bun-e2e.test.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: build-test (20.x, sqlite)
- GitHub Check: build-test (20.x, postgresql)
- GitHub Check: claude-review
🔇 Additional comments (2)
tests/runtimes/bun/bun-e2e.test.ts (2)
18-20: Good practice: proper test cleanup.The afterEach hook correctly disconnects the database client after each test, preventing connection leaks. The optional chaining safely handles cases where _db might be undefined.
23-23: Well done: assignment pattern addresses previous type-safety concern.The pattern
const db = (_db = await createClient(...))gives each test a strongly-typed, non-optional local client while preserving the shared_dbreference for cleanup. This elegantly resolves the previous review concern about using a possibly-undefined client directly in test assertions.Also applies to: 53-53
Also applies to: 53-53
Summary by CodeRabbit
New Features
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.