mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 05:44:33 +00:00
test: dedupe shared setup in channel and doctor config tests
This commit is contained in:
@@ -23,6 +23,19 @@ async function runDoctorConfigWithInput(params: {
|
||||
});
|
||||
}
|
||||
|
||||
function expectGoogleChatDmAllowFromRepaired(cfg: unknown) {
|
||||
const typed = cfg as {
|
||||
channels: {
|
||||
googlechat: {
|
||||
dm: { allowFrom: string[] };
|
||||
allowFrom?: string[];
|
||||
};
|
||||
};
|
||||
};
|
||||
expect(typed.channels.googlechat.dm.allowFrom).toEqual(["*"]);
|
||||
expect(typed.channels.googlechat.allowFrom).toBeUndefined();
|
||||
}
|
||||
|
||||
describe("doctor config flow", () => {
|
||||
it("preserves invalid config for doctor repairs", async () => {
|
||||
const result = await runDoctorConfigWithInput({
|
||||
@@ -361,20 +374,7 @@ describe("doctor config flow", () => {
|
||||
},
|
||||
});
|
||||
|
||||
const cfg = result.cfg as unknown as {
|
||||
channels: {
|
||||
googlechat: {
|
||||
dm: {
|
||||
policy: string;
|
||||
allowFrom: string[];
|
||||
};
|
||||
allowFrom?: string[];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
expect(cfg.channels.googlechat.dm.allowFrom).toEqual(["*"]);
|
||||
expect(cfg.channels.googlechat.allowFrom).toBeUndefined();
|
||||
expectGoogleChatDmAllowFromRepaired(result.cfg);
|
||||
});
|
||||
|
||||
it("repairs googlechat account dm.policy open by setting dm.allowFrom on repair", async () => {
|
||||
@@ -430,19 +430,6 @@ describe("doctor config flow", () => {
|
||||
},
|
||||
});
|
||||
|
||||
const cfg = result.cfg as unknown as {
|
||||
channels: {
|
||||
googlechat: {
|
||||
dm: {
|
||||
policy: string;
|
||||
allowFrom: string[];
|
||||
};
|
||||
allowFrom?: string[];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
expect(cfg.channels.googlechat.dm.allowFrom).toEqual(["*"]);
|
||||
expect(cfg.channels.googlechat.allowFrom).toBeUndefined();
|
||||
expectGoogleChatDmAllowFromRepaired(result.cfg);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user