mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 19:04:45 +00:00
test: dedupe channels remove mock reads
This commit is contained in:
@@ -65,6 +65,12 @@ vi.mock("../gateway/call.js", () => ({
|
||||
|
||||
const runtime = createTestRuntime();
|
||||
|
||||
function firstWrittenChannelsConfig() {
|
||||
return configMocks.writeConfigFile.mock.calls[0]?.[0] as
|
||||
| { channels?: Record<string, unknown> }
|
||||
| undefined;
|
||||
}
|
||||
|
||||
describe("channelsRemoveCommand", () => {
|
||||
beforeAll(async () => {
|
||||
({ channelsRemoveCommand } = await import("./channels.js"));
|
||||
@@ -171,9 +177,7 @@ describe("channelsRemoveCommand", () => {
|
||||
|
||||
expect(ensureChannelSetupPluginInstalled).not.toHaveBeenCalled();
|
||||
expect(registryRefreshMocks.refreshPluginRegistryAfterConfigMutation).not.toHaveBeenCalled();
|
||||
const writtenConfig = configMocks.writeConfigFile.mock.calls.at(0)?.[0] as
|
||||
| { channels?: Record<string, unknown> }
|
||||
| undefined;
|
||||
const writtenConfig = firstWrittenChannelsConfig();
|
||||
expect(writtenConfig?.channels?.["external-chat"]).toBeUndefined();
|
||||
expect(runtime.error).not.toHaveBeenCalled();
|
||||
expect(runtime.exit).not.toHaveBeenCalled();
|
||||
@@ -237,9 +241,7 @@ describe("channelsRemoveCommand", () => {
|
||||
clientName: "gateway-client",
|
||||
deviceIdentity: null,
|
||||
});
|
||||
const writtenConfig = configMocks.writeConfigFile.mock.calls.at(0)?.[0] as
|
||||
| { channels?: Record<string, unknown> }
|
||||
| undefined;
|
||||
const writtenConfig = firstWrittenChannelsConfig();
|
||||
expect(writtenConfig?.channels?.["external-chat"]).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user