test(typegen): add mock infrastructure for unit tests#103
Merged
eluce2 merged 5 commits into01-12-test_better-auth_add_mock_infrastructure_for_unit_testsfrom Jan 12, 2026
Conversation
Remove fmodata E2E step and Doppler auth from continuous-release.yml. Add root-level test:e2e script and turbo task for local E2E runs. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Create capture script for recording live API responses - Add mock-fetch utility for mocking global fetch in tests - Reorganize tests: move E2E tests to tests/e2e/ - Create mock-based unit tests that don't require live FM server - Update vitest config to exclude E2E tests by default - Add test:e2e and capture scripts to package.json Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- 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 <noreply@anthropic.com>
- 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 - Update vitest.config.ts to exclude e2e tests by default - Add test:e2e script for running E2E tests with doppler Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
2f2c31f
into
01-12-test_better-auth_add_mock_infrastructure_for_unit_tests
9 of 11 checks passed
| const client = DataApi({ | ||
| adapter: new OttoAdapter({ | ||
| auth: config.auth, | ||
| db: config.db, |
There was a problem hiding this comment.
Test silently passes when no error is thrown
Low Severity
The error handling test uses .catch() to make assertions, but if client.list() resolves successfully instead of rejecting, the catch block never executes and the test passes without verifying any assertions. This pattern can lead to false positives if the mock is misconfigured or the error handling behavior changes. The test should use await expect(...).rejects.toBeInstanceOf(FileMakerError) or similar to ensure the promise actually rejects.
eluce2
added a commit
that referenced
this pull request
Jan 12, 2026
## 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] > Modernizes testing and docs across packages, separating fast unit tests from live E2E runs and adding reusable CLI/docs components. > > - Testing: Add mock fetch utilities and recorded fixtures for `@proofkit/better-auth` and `@proofkit/fmdapi`; create layout metadata fixtures and unit tests in `@proofkit/typegen`; move live tests to `tests/e2e`; update `vitest.config.ts` to exclude E2E by default; add `test:e2e` scripts and Turbo pipeline > - CI: Simplify `continuous-release.yml` test job to run unit tests only (remove Doppler/OIDC/E2E); keep build after tests > - Tooling: Add `scripts/capture-responses.ts` to record FM API responses for mocks; add `vitest.config.ts` per package with E2E exclusion > - Docs/UI: Introduce `PackageInstall` component and enhance `CliCommand` (new `packageName` prop); update MDX guides to use these components and stable package refs > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 3e25bc9. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
3 tasks
eluce2
added a commit
that referenced
this pull request
Jan 12, 2026
## 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] > Modernizes testing and docs across packages, separating fast unit tests from live E2E runs and adding reusable CLI/docs components. > > - Testing: Add mock fetch utilities and recorded fixtures for `@proofkit/better-auth` and `@proofkit/fmdapi`; create layout metadata fixtures and unit tests in `@proofkit/typegen`; move live tests to `tests/e2e`; update `vitest.config.ts` to exclude E2E by default; add `test:e2e` scripts and Turbo pipeline > - CI: Simplify `continuous-release.yml` test job to run unit tests only (remove Doppler/OIDC/E2E); keep build after tests > - Tooling: Add `scripts/capture-responses.ts` to record FM API responses for mocks; add `vitest.config.ts` per package with E2E exclusion > - Docs/UI: Introduce `PackageInstall` component and enhance `CliCommand` (new `packageName` prop); update MDX guides to use these components and stable package refs > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 3e25bc9. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
eluce2
added a commit
that referenced
this pull request
Jan 12, 2026
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 <noreply@anthropic.com> 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 <noreply@anthropic.com>
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.
Summary
tests/fixtures/layout-metadata.ts)tests/utils/mock-fetch.ts)tests/e2e/vitest.config.tsto exclude e2e tests by defaulttest:e2escript for running E2E tests with dopplerTest plan
pnpm --filter @proofkit/typegen lintpassespnpm --filter @proofkit/typegen typecheckpassespnpm --filter @proofkit/typegen testpasses (11 unit tests)🤖 Generated with Claude Code
Note
Modernizes testing and docs across packages, separating fast unit tests from live E2E runs and adding reusable CLI/docs components.
@proofkit/better-authand@proofkit/fmdapi; create layout metadata fixtures and unit tests in@proofkit/typegen; move live tests totests/e2e; updatevitest.config.tsto exclude E2E by default; addtest:e2escripts and Turbo pipelinecontinuous-release.ymltest job to run unit tests only (remove Doppler/OIDC/E2E); keep build after testsscripts/capture-responses.tsto record FM API responses for mocks; addvitest.config.tsper package with E2E exclusionPackageInstallcomponent and enhanceCliCommand(newpackageNameprop); update MDX guides to use these components and stable package refsWritten by Cursor Bugbot for commit 3e25bc9. This will update automatically on new commits. Configure here.