Skip to content

Commit d241d22

Browse files
test(config): assert the imported object that actually reaches storage
CodeRabbit pre-merge check Regression Evidence (warning) on e265d53: the host-local path import test asserted the returned summary only. The value the extension uses is the one handed to contextProxy.setValues, so the test now pins that object: exactly one setValues call, mode "code" present, and none of lastSettingsExportPath, lastTaskExportPath, lastModeExportPath or lastImageSavePath. Dropping any key from hostLocalPathKeys is killed by this test (checked for two of the four: lastSettingsExportPath and lastImageSavePath). importExport.spec.ts: 66 passed / 1 failed, the failure being the pre-existing Windows "round-trips a prompt cache TTL through export and import" tracked by #2059. ESLint exits 0 with --max-warnings=0; eslint-suppressions.json untouched.
1 parent c61e97b commit d241d22

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎src/core/config/__tests__/importExport.spec.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,16 @@ describe("importExport", () => {
413413
expect(result.globalSettings).not.toHaveProperty("lastTaskExportPath")
414414
expect(result.globalSettings).not.toHaveProperty("lastModeExportPath")
415415
expect(result.globalSettings).not.toHaveProperty("lastImageSavePath")
416+
// What matters is what reaches storage: setValues installs the imported object,
417+
// so the foreign dialog memory has to be gone from the value the extension will
418+
// actually use, not only from the summary returned to the caller.
419+
expect(mockContextProxy.setValues).toHaveBeenCalledTimes(1)
420+
const installedGlobalSettings = mockContextProxy.setValues.mock.calls[0][0]
421+
expect(installedGlobalSettings).toEqual(expect.objectContaining({ mode: "code" }))
422+
expect(installedGlobalSettings).not.toHaveProperty("lastSettingsExportPath")
423+
expect(installedGlobalSettings).not.toHaveProperty("lastTaskExportPath")
424+
expect(installedGlobalSettings).not.toHaveProperty("lastModeExportPath")
425+
expect(installedGlobalSettings).not.toHaveProperty("lastImageSavePath")
416426
// Dropped silently: every export contains these keys, so warning on each
417427
// import would report nothing the user can act on. The whole warning list is
418428
// the assertion here — this import has nothing to report.

0 commit comments

Comments
 (0)