























@@ -52,13 +52,14 @@ describe("registerMaintenanceCommands doctor action", () => {
52525353await runMaintenanceCli(["doctor", "--non-interactive", "--yes"]);
545455-expect(doctorCommand).toHaveBeenCalledWith(
56-runtime,
57-expect.objectContaining({
58-nonInteractive: true,
59-yes: true,
60-}),
61-);
55+expect(doctorCommand).toHaveBeenCalledTimes(1);
56+const [runtimeArg, options] = doctorCommand.mock.calls[0] as unknown as [
57+typeof runtime,
58+Record<string, unknown>,
59+];
60+expect(runtimeArg).toBe(runtime);
61+expect(options.nonInteractive).toBe(true);
62+expect(options.yes).toBe(true);
6263expect(runtime.exit).toHaveBeenCalledWith(0);
6364});
6465@@ -77,25 +78,27 @@ describe("registerMaintenanceCommands doctor action", () => {
77787879await runMaintenanceCli(["doctor", "--fix"]);
798080-expect(doctorCommand).toHaveBeenCalledWith(
81-runtime,
82-expect.objectContaining({
83-repair: true,
84-}),
85-);
81+expect(doctorCommand).toHaveBeenCalledTimes(1);
82+const [runtimeArg, options] = doctorCommand.mock.calls[0] as unknown as [
83+typeof runtime,
84+Record<string, unknown>,
85+];
86+expect(runtimeArg).toBe(runtime);
87+expect(options.repair).toBe(true);
8688});
87898890it("passes noOpen to dashboard command", async () => {
8991dashboardCommand.mockResolvedValue(undefined);
90929193await runMaintenanceCli(["dashboard", "--no-open"]);
929493-expect(dashboardCommand).toHaveBeenCalledWith(
94-runtime,
95-expect.objectContaining({
96-noOpen: true,
97-}),
98-);
95+expect(dashboardCommand).toHaveBeenCalledTimes(1);
96+const [runtimeArg, options] = dashboardCommand.mock.calls[0] as unknown as [
97+typeof runtime,
98+Record<string, unknown>,
99+];
100+expect(runtimeArg).toBe(runtime);
101+expect(options.noOpen).toBe(true);
99102});
100103101104it("passes reset options to reset command", async () => {
@@ -110,15 +113,16 @@ describe("registerMaintenanceCommands doctor action", () => {
110113"--dry-run",
111114]);
112115113-expect(resetCommand).toHaveBeenCalledWith(
114-runtime,
115-expect.objectContaining({
116-scope: "full",
117-yes: true,
118-nonInteractive: true,
119-dryRun: true,
120-}),
121-);
116+expect(resetCommand).toHaveBeenCalledTimes(1);
117+const [runtimeArg, options] = resetCommand.mock.calls[0] as unknown as [
118+typeof runtime,
119+Record<string, unknown>,
120+];
121+expect(runtimeArg).toBe(runtime);
122+expect(options.scope).toBe("full");
123+expect(options.yes).toBe(true);
124+expect(options.nonInteractive).toBe(true);
125+expect(options.dryRun).toBe(true);
122126});
123127124128it("passes uninstall options to uninstall command", async () => {
@@ -136,19 +140,20 @@ describe("registerMaintenanceCommands doctor action", () => {
136140"--dry-run",
137141]);
138142139-expect(uninstallCommand).toHaveBeenCalledWith(
140-runtime,
141-expect.objectContaining({
142-service: true,
143-state: true,
144-workspace: true,
145-app: true,
146-all: true,
147-yes: true,
148-nonInteractive: true,
149-dryRun: true,
150-}),
151-);
143+expect(uninstallCommand).toHaveBeenCalledTimes(1);
144+const [runtimeArg, options] = uninstallCommand.mock.calls[0] as unknown as [
145+typeof runtime,
146+Record<string, unknown>,
147+];
148+expect(runtimeArg).toBe(runtime);
149+expect(options.service).toBe(true);
150+expect(options.state).toBe(true);
151+expect(options.workspace).toBe(true);
152+expect(options.app).toBe(true);
153+expect(options.all).toBe(true);
154+expect(options.yes).toBe(true);
155+expect(options.nonInteractive).toBe(true);
156+expect(options.dryRun).toBe(true);
152157});
153158154159it("exits with code 1 when dashboard fails", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。