


























@@ -268,7 +268,8 @@ describe("migrateApplyCommand", () => {
268268expect(mocks.provider.plan).toHaveBeenCalledTimes(1);
269269expect(mocks.promptYesNo).toHaveBeenCalledWith("Apply this migration now?", false);
270270expect(mocks.backupCreateCommand).toHaveBeenCalled();
271-expect(mocks.provider.apply).toHaveBeenCalledWith(expect.any(Object), planned);
271+expect(typeof mocks.provider.apply.mock.calls[0]?.[0]).toBe("object");
272+expect(mocks.provider.apply.mock.calls[0]?.[1]).toBe(planned);
272273});
273274274275it("prompts for Codex skills before interactive default apply", async () => {
@@ -290,43 +291,34 @@ describe("migrateApplyCommand", () => {
290291291292await migrateDefaultCommand(runtime, { provider: "codex" });
292293293-expect(mocks.multiselect).toHaveBeenCalledWith(
294-expect.objectContaining({
295-message: expect.stringContaining("Select Codex skills"),
296-initialValues: ["skill:alpha", "skill:beta"],
297-required: false,
298-options: [
299-expect.objectContaining({
300-value: MIGRATION_SKILL_SELECTION_SKIP,
301-label: "Skip for now",
302-}),
303-expect.objectContaining({
304-value: MIGRATION_SKILL_SELECTION_TOGGLE_ALL_ON,
305-label: "Toggle all on",
306-}),
307-expect.objectContaining({
308-value: MIGRATION_SKILL_SELECTION_TOGGLE_ALL_OFF,
309-label: "Toggle all off",
310-}),
311-expect.objectContaining({ value: "skill:alpha", label: "alpha" }),
312-expect.objectContaining({ value: "skill:beta", label: "beta" }),
313-],
314-}),
315-);
294+const selectionPrompt = mocks.multiselect.mock.calls[0]?.[0] as
295+| {
296+initialValues?: unknown;
297+message?: unknown;
298+options?: Array<{ label?: unknown; value?: unknown }>;
299+required?: unknown;
300+}
301+| undefined;
302+expect(String(selectionPrompt?.message)).toContain("Select Codex skills");
303+expect(selectionPrompt?.initialValues).toStrictEqual(["skill:alpha", "skill:beta"]);
304+expect(selectionPrompt?.required).toBe(false);
305+expect(selectionPrompt?.options?.map(({ label, value }) => ({ label, value }))).toStrictEqual([
306+{ value: MIGRATION_SKILL_SELECTION_SKIP, label: "Skip for now" },
307+{ value: MIGRATION_SKILL_SELECTION_TOGGLE_ALL_ON, label: "Toggle all on" },
308+{ value: MIGRATION_SKILL_SELECTION_TOGGLE_ALL_OFF, label: "Toggle all off" },
309+{ value: "skill:alpha", label: "alpha" },
310+{ value: "skill:beta", label: "beta" },
311+]);
316312expect(mocks.promptYesNo).toHaveBeenCalledWith("Apply this migration now?", false);
317313const appliedPlan = mocks.provider.apply.mock.calls[0]?.[1] as MigrationPlan;
318-expect(appliedPlan.summary).toMatchObject({ planned: 2, skipped: 1, conflicts: 0 });
319-expect(appliedPlan.items).toEqual(
320-expect.arrayContaining([
321-expect.objectContaining({ id: "skill:alpha", status: "planned" }),
322-expect.objectContaining({
323-id: "skill:beta",
324-status: "skipped",
325-reason: "not selected for migration",
326-}),
327-expect.objectContaining({ id: "archive:config.toml", status: "planned" }),
328-]),
329-);
314+expect(appliedPlan.summary.planned).toBe(2);
315+expect(appliedPlan.summary.skipped).toBe(1);
316+expect(appliedPlan.summary.conflicts).toBe(0);
317+const itemsById = new Map(appliedPlan.items.map((item) => [item.id, item]));
318+expect(itemsById.get("skill:alpha")?.status).toBe("planned");
319+expect(itemsById.get("skill:beta")?.status).toBe("skipped");
320+expect(itemsById.get("skill:beta")?.reason).toBe("not selected for migration");
321+expect(itemsById.get("archive:config.toml")?.status).toBe("planned");
330322});
331323332324it("prompts for native Codex plugins after interactive skill selection", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。