@@ -54,6 +54,15 @@ const makeDiscoveryService = (params: {
|
54 | 54 | }, |
55 | 55 | }); |
56 | 56 | |
| 57 | +function latestZoneParams(): Parameters<WriteWideAreaGatewayZone>[0] { |
| 58 | +const calls = mocks.writeWideAreaGatewayZone.mock.calls; |
| 59 | +const call = calls[calls.length - 1]; |
| 60 | +if (!call) { |
| 61 | +throw new Error("Expected wide-area gateway zone to be written"); |
| 62 | +} |
| 63 | +return call[0]; |
| 64 | +} |
| 65 | + |
57 | 66 | describe("startGatewayDiscovery", () => { |
58 | 67 | const prevEnv = { ...process.env }; |
59 | 68 | |
@@ -220,10 +229,7 @@ describe("startGatewayDiscovery", () => {
|
220 | 229 | |
221 | 230 | expect(service.service.advertise).not.toHaveBeenCalled(); |
222 | 231 | expect(mocks.resolveTailnetDnsHint).toHaveBeenCalledWith({ enabled: true }); |
223 | | -const [zoneParams] = mocks.writeWideAreaGatewayZone.mock.calls.at(-1) ?? []; |
224 | | -if (zoneParams === undefined) { |
225 | | -throw new Error("Expected wide-area gateway zone to be written"); |
226 | | -} |
| 232 | +const zoneParams = latestZoneParams(); |
227 | 233 | expect(zoneParams.domain).toBe("openclaw.internal."); |
228 | 234 | expect(zoneParams.gatewayPort).toBe(18789); |
229 | 235 | expect(zoneParams.displayName).toBe("Lab Mac (OpenClaw)"); |
@@ -253,10 +259,7 @@ describe("startGatewayDiscovery", () => {
|
253 | 259 | logDiscovery: logs, |
254 | 260 | }); |
255 | 261 | |
256 | | -const [zoneParams] = mocks.writeWideAreaGatewayZone.mock.calls.at(-1) ?? []; |
257 | | -if (zoneParams === undefined) { |
258 | | -throw new Error("Expected wide-area gateway zone to be written"); |
259 | | -} |
| 262 | +const zoneParams = latestZoneParams(); |
260 | 263 | expect(zoneParams.cliPath).toBeUndefined(); |
261 | 264 | expect(mocks.resolveBonjourCliPath).not.toHaveBeenCalled(); |
262 | 265 | }); |
|