Commit aadb70b
test(better-auth): add mock infrastructure for unit tests (#104)
test(better-auth): add mock infrastructure for unit tests
- Move E2E tests (adapter.test.ts, migrate.test.ts) to tests/e2e/
- Create mock fetch utilities and OData response fixtures
- Add unit tests for adapter operations using mocked responses
- Update vitest.config.ts to exclude E2E tests
- Add test:e2e script for running E2E tests separately
Co-Authored-By: Claude Opus 4.5 <[email protected]>
test(typegen): add mock infrastructure for unit tests (#103)
## Summary
- Create layout metadata fixtures (`tests/fixtures/layout-metadata.ts`)
- Add mock fetch utility for mocking FM Data API calls (`tests/utils/mock-fetch.ts`)
- Move E2E tests requiring live FM server to `tests/e2e/`
- Create unit tests that use mocked metadata (11 tests)
- Update `vitest.config.ts` to exclude e2e tests by default
- Add `test:e2e` script for running E2E tests with doppler
## Test plan
- [x] `pnpm --filter @proofkit/typegen lint` passes
- [x] `pnpm --filter @proofkit/typegen typecheck` passes
- [x] `pnpm --filter @proofkit/typegen test` passes (11 unit tests)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Establishes isolated unit testing with mocks and separates E2E runs across the repo.
>
> - **Better Auth**: Add mock OData responses and `mock-fetch` utils; create comprehensive adapter unit tests; move adapter/migrate E2E to `tests/e2e`; add `test:e2e` script; update `vitest.config.ts` to exclude E2E; small refactor in `migrate.ts` for safer type normalization and explicit FM type mapping
> - **Typegen**: Add layout metadata fixtures and mock fetch utils; create unit tests using mocked metadata; move live E2E to `tests/e2e`; add `test:e2e` script; update `vitest.config.ts` to exclude E2E
> - **Fmodata**: Relocate E2E tests to `tests/e2e`; update `test:e2e` to run folder
> - **CLI**: Simplify `test` script to `vitest run`; update vitest config to exclude E2E-like test
> - **Repo scripts**: Tweak `scripts/ralph-once.sh` workflow command
>
> <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 67a2fec. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
test(fmodata): move E2E tests to tests/e2e folder
Move e2e.test.ts and schema-manager.test.ts to tests/e2e/ so they're excluded from default test runs. Update test:e2e script to run entire e2e folder.
Co-Authored-By: Claude Opus 4.5 <[email protected]>1 parent 6dba78e commit aadb70b
File tree
22 files changed
+2002
-430
lines changed- packages
- better-auth
- src
- tests
- e2e
- fixtures
- utils
- cli
- fmodata
- tests/e2e
- typegen
- tests
- e2e
- fixtures
- utils
- scripts
22 files changed
+2002
-430
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
13 | 17 | | |
14 | 18 | | |
15 | 19 | | |
| |||
106 | 110 | | |
107 | 111 | | |
108 | 112 | | |
109 | | - | |
110 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
111 | 119 | | |
112 | 120 | | |
113 | 121 | | |
| |||
0 commit comments