@@ -65,6 +65,12 @@ vi.mock("../gateway/call.js", () => ({
|
65 | 65 | |
66 | 66 | const runtime = createTestRuntime(); |
67 | 67 | |
| 68 | +function firstWrittenChannelsConfig() { |
| 69 | +return configMocks.writeConfigFile.mock.calls[0]?.[0] as |
| 70 | +| { channels?: Record<string, unknown> } |
| 71 | +| undefined; |
| 72 | +} |
| 73 | + |
68 | 74 | describe("channelsRemoveCommand", () => { |
69 | 75 | beforeAll(async () => { |
70 | 76 | ({ channelsRemoveCommand } = await import("./channels.js")); |
@@ -171,9 +177,7 @@ describe("channelsRemoveCommand", () => {
|
171 | 177 | |
172 | 178 | expect(ensureChannelSetupPluginInstalled).not.toHaveBeenCalled(); |
173 | 179 | expect(registryRefreshMocks.refreshPluginRegistryAfterConfigMutation).not.toHaveBeenCalled(); |
174 | | -const writtenConfig = configMocks.writeConfigFile.mock.calls.at(0)?.[0] as |
175 | | -| { channels?: Record<string, unknown> } |
176 | | -| undefined; |
| 180 | +const writtenConfig = firstWrittenChannelsConfig(); |
177 | 181 | expect(writtenConfig?.channels?.["external-chat"]).toBeUndefined(); |
178 | 182 | expect(runtime.error).not.toHaveBeenCalled(); |
179 | 183 | expect(runtime.exit).not.toHaveBeenCalled(); |
@@ -237,9 +241,7 @@ describe("channelsRemoveCommand", () => {
|
237 | 241 | clientName: "gateway-client", |
238 | 242 | deviceIdentity: null, |
239 | 243 | }); |
240 | | -const writtenConfig = configMocks.writeConfigFile.mock.calls.at(0)?.[0] as |
241 | | -| { channels?: Record<string, unknown> } |
242 | | -| undefined; |
| 244 | +const writtenConfig = firstWrittenChannelsConfig(); |
243 | 245 | expect(writtenConfig?.channels?.["external-chat"]).toBeUndefined(); |
244 | 246 | }); |
245 | 247 | }); |