GGitHubfix: vitest upgrade (#6315)
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
fix(cli): migration not generating request and hash (#5461) ## Problem The CLI mock migrator was producing incomplete unified mocks for some legacy fixtures: - `request` ended up empty and `hash` was `""` even when the runtime call had enough info. - Some endpoints were migrated with an empty array even though a legacy API call existed (notably when legacy response body was falsy, like `""`). - This caused lookup failures such as: - `No mock found for DELETE ... with hash ...` ## Solution Updated `packages/cli/lib/testMocks/utils.ts` to improve migration behavior: - **Backfill request/hash from runtime identity** when legacy mock files are response-only (missing `requestIdentity*` fields). - **Preserve legacy identity when present** (don’t overwrite valid legacy request/hash). - **Parse JSON request body strings** when possible during backfill (keep raw string when non-JSON). - **Include falsy legacy name-based responses** by checking `response !== undefined` instead of truthy checks. - This fixes empty migrated API arrays for cases like `""`, `0`, `false`, `null`. Also added test coverage: - Split tests into: - `packages/cli/lib/testMocks/utils.legacy.unit.cli-test.ts` - `packages/cli/lib/testMocks/utils.unified.unit.cli-test.ts` - Added regression tests for: - response-only legacy backfill - legacy-identity precedence - non-JSON body fallback - hash-based dedupe - falsy legacy responses - hash-dir exact match + params fallback - unified-over-legacy precedence (with and without `MIGRATE_MOCKS`) - unified matching behavior (endpoint normalization, object/array entries, header/params matching, fallback semantics) ## Ticket NAN-4786 ## Testing Run: - `npx vitest --config vite.cli.config.ts packages/cli/lib/testMocks/utils.legacy.unit.cli-test.ts packages/cli/lib/testMocks/utils.unified.unit.cli-test.ts --run` Expected: - 2 test files pass - 13 tests pass in total <!-- Summary by @propel-code-bot --> --- One remaining concern is how the migrator handles partially specified legacy identities—these are treated as complete and therefore skip runtime backfilling, and deduplication now hinges on the runtime-provided hashes when legacy files lacked them, which could affect scenarios with multiple distinct bodies sharing a response-only fixture. <details> <summary><strong>Possible Issues</strong></summary> • When a legacy mock provides only some identity fields (e.g., params but no headers/data), `hasLegacyIdentity` treats it as complete and skips runtime backfill for the missing pieces; verify this matches intended behavior. • Backfilled hashes rely on runtime `identity.requestIdentityHash`; if multiple runtime requests with different bodies hit the same response-only legacy file within a single migration run, only distinct hashes will deduplicate—ensure this aligns with expected dedupe semantics. </details> --- *This summary was automatically generated by @propel-code-bot* | 6 个月前 | |
fix: vitest upgrade (#6315) <!-- Describe the problem and your solution --> <!-- Issue ticket number and link (if applicable) --> <!-- Testing instructions (skip if just adding/editing providers) --> | 3 个月前 | |
fix(sdk): Add checkpoint methods to mock classes (#5603) <!-- Describe the problem and your solution --> <!-- Issue ticket number and link (if applicable) --> <!-- Testing instructions (skip if just adding/editing providers) --> <!-- Summary by @propel-code-bot --> --- **Add checkpoint support to `NangoSyncMock` with tests** This PR adds in-memory checkpoint handling to the `NangoSyncMock` test helper and introduces a unit test validating save/get/clear behavior. It also updates imports and types to include the new `Checkpoint` type and uses the new mock in the unified mocks test file. --- *This summary was automatically generated by @propel-code-bot* | 5 个月前 |