-
Notifications
You must be signed in to change notification settings - Fork 1
test(typegen): add mock infrastructure for unit tests #103
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
test(typegen): add mock infrastructure for unit tests #103
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
| const client = DataApi({ | ||
| adapter: new OttoAdapter({ | ||
| auth: config.auth, | ||
| db: config.db, |
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.
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.
## 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 -->
## 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 -->
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>
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.