Skip to content

Commit 9065377

Browse files
committed
test: speed up update cli tests
1 parent 27ad3d7 commit 9065377

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

src/cli/update-cli.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ vi.mock("../infra/restart-stale-pids.js", () => ({
174174
getSelfAndAncestorPidsSync: () => mockGetSelfAndAncestorPidsSync(),
175175
}));
176176

177+
vi.mock("../infra/update-managed-service-handoff-cleanup.js", () => ({
178+
cleanupStaleManagedServiceUpdateHandoffs: vi.fn(async () => 0),
179+
}));
180+
177181
vi.mock("node:child_process", async () => {
178182
const actual = await vi.importActual<typeof import("node:child_process")>("node:child_process");
179183
return {
@@ -224,6 +228,32 @@ vi.mock("../plugins/installed-plugin-index-records.js", async (importOriginal) =
224228
};
225229
});
226230

231+
vi.mock("./update-cli/post-core-plugin-convergence.js", () => ({
232+
convergenceWarningsToOutcomes: (convergence: {
233+
warnings: Array<{ pluginId?: string; message: string }>;
234+
errored: boolean;
235+
}) => ({
236+
warnings: convergence.warnings,
237+
outcomes: convergence.warnings
238+
.filter((warning): warning is { pluginId: string; message: string } =>
239+
Boolean(warning.pluginId),
240+
)
241+
.map((warning) => ({
242+
pluginId: warning.pluginId,
243+
status: "error",
244+
message: warning.message,
245+
})),
246+
errored: convergence.errored,
247+
}),
248+
runPostCorePluginConvergence: vi.fn(async (params: { baselineInstallRecords?: unknown }) => ({
249+
changes: [],
250+
warnings: [],
251+
errored: false,
252+
smokeFailures: [],
253+
installRecords: params.baselineInstallRecords ?? {},
254+
})),
255+
}));
256+
227257
vi.mock("../daemon/service.js", () => ({
228258
readGatewayServiceState: async () => {
229259
const command = await serviceReadCommand();

0 commit comments

Comments
 (0)