|
1 | 1 | import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; |
| 2 | +import type { GatewayServiceRestartResult } from "../daemon/service-types.js"; |
2 | 3 |
|
3 | 4 | const originalArgv = [...process.argv]; |
4 | 5 | type MockGatewayTlsRuntime = { |
@@ -51,7 +52,11 @@ function createDefaultConfig() { |
51 | 52 | }, |
52 | 53 | }; |
53 | 54 | } |
54 | | -const restartService = vi.hoisted(() => vi.fn(async () => ({ outcome: "completed" as const }))); |
| 55 | +const restartService = vi.hoisted(() => |
| 56 | + vi.fn<() => Promise<GatewayServiceRestartResult>>(async () => ({ |
| 57 | + outcome: "completed", |
| 58 | + })), |
| 59 | +); |
55 | 60 | const readServiceCommand = vi.hoisted(() => |
56 | 61 | vi.fn< |
57 | 62 | () => Promise<{ |
@@ -1104,7 +1109,7 @@ describe("runRescueWatchdogJob", () => { |
1104 | 1109 | close: { code: 1006, reason: "down" }, |
1105 | 1110 | error: "down", |
1106 | 1111 | }); |
1107 | | - restartService.mockImplementation(() => new Promise<void>(() => {})); |
| 1112 | + restartService.mockImplementation(() => new Promise<GatewayServiceRestartResult>(() => {})); |
1108 | 1113 |
|
1109 | 1114 | const runPromise = runRescueWatchdogJob({ |
1110 | 1115 | job: { |
@@ -1135,8 +1140,8 @@ describe("runRescueWatchdogJob", () => { |
1135 | 1140 | }); |
1136 | 1141 | restartService.mockImplementation( |
1137 | 1142 | () => |
1138 | | - new Promise<void>((resolve) => { |
1139 | | - setTimeout(resolve, 60_000); |
| 1143 | + new Promise<GatewayServiceRestartResult>((resolve) => { |
| 1144 | + setTimeout(() => resolve({ outcome: "completed" }), 60_000); |
1140 | 1145 | }), |
1141 | 1146 | ); |
1142 | 1147 | const abort = new AbortController(); |
@@ -1169,7 +1174,7 @@ describe("runRescueWatchdogJob", () => { |
1169 | 1174 | close: { code: 1006, reason: "down" }, |
1170 | 1175 | error: "down", |
1171 | 1176 | }); |
1172 | | - restartService.mockImplementation(() => new Promise<void>(() => {})); |
| 1177 | + restartService.mockImplementation(() => new Promise<GatewayServiceRestartResult>(() => {})); |
1173 | 1178 |
|
1174 | 1179 | let settled = false; |
1175 | 1180 | const runPromise = runRescueWatchdogJob({ |
|
0 commit comments