Skip to content

Conversation

@brandonkachen
Copy link
Collaborator

No description provided.

- Add TestableDb interface to common/types/contracts/database.ts for type-safe database mocking
- Move mock-db.ts from web/src/testing to common/src/testing
- Add createSelectOnlyMockDb for version-utils query patterns
- Add createMockDb, createMockDbWithErrors for API route testing
- Update API routes to use TestableDb interface instead of CodebuffPgDatabase
- Refactor test files to use shared mock-db utilities without type assertions
- All 1,647+ tests passing across packages
Use runtime detection to conditionally load bun:test mock function.
Falls back to identity function when running in Jest.
Jest cannot resolve bun:test at parse time even with runtime checks.
Add moduleNameMapper to stub bun:test with an identity function.
Add testPathIgnorePatterns for dependencies test that uses bun:test directly.
…ping

Playwright requires test.use() to be called inside a describe block.
TestableDb is a testing-specific interface, so it belongs with the mock utilities.
TestableDb implied it was only for testing, but it is used as a
parameter type in production code. DbOperations is more accurate.
… location

- Move DbOperations and DbWhereResult from testing/mock-db.ts to types/contracts/database.ts
- Update production imports in version-utils.ts, agent-runs/_post.ts, steps/_post.ts
- Re-export from mock-db.ts for backwards compatibility with test imports
- Fix type error in dependencies/_get.ts by handling version: string | null
- Update knowledge.md with proper import guidance
- Rename store-hydration.test.ts -> store-hydration.e2e.ts
- Rename store-ssr.test.ts -> store-ssr.e2e.ts
- Update playwright.config.ts to match .e2e.ts files
- Add web/bunfig.toml for test runner configuration

This prevents Bun test runner from picking up Playwright tests,
which should only be run via `bun run e2e`
The .e2e.ts extension is sufficient to exclude Playwright tests from Bun test runner
Tests in lib/__tests__ use bun:test mock.module() which is not
supported by the Jest stub. These tests should run with bun test only.

This fixes CI failure where ban-conditions.test.ts failed due to
missing fetch polyfill when Stripe SDK was initialized.
…ib/__tests__

agent-tree.test.ts uses Jest globals and should run in CI
# Conflicts:
#	web/jest.config.cjs
#	web/playwright.config.ts
#	web/src/__tests__/e2e/store-ssr.e2e.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants