mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 16:04:59 +00:00
chore: Fix types in tests 42/N.
This commit is contained in:
@@ -40,6 +40,14 @@ function makeUnauthorizedWhatsAppCfg(home: string) {
|
||||
};
|
||||
}
|
||||
|
||||
function requireSessionStorePath(cfg: { session?: { store?: string } }): string {
|
||||
const storePath = cfg.session?.store;
|
||||
if (!storePath) {
|
||||
throw new Error("expected session store path");
|
||||
}
|
||||
return storePath;
|
||||
}
|
||||
|
||||
async function runInlineUnauthorizedCommand(params: {
|
||||
home: string;
|
||||
command: "/status" | "/help";
|
||||
@@ -143,7 +151,7 @@ describe("trigger handling", () => {
|
||||
const text = Array.isArray(res) ? res[0]?.text : res?.text;
|
||||
expect(text).toContain("Send policy set to off");
|
||||
|
||||
const storeRaw = await fs.readFile(cfg.session!.store, "utf-8");
|
||||
const storeRaw = await fs.readFile(requireSessionStorePath(cfg), "utf-8");
|
||||
const store = JSON.parse(storeRaw) as Record<string, { sendPolicy?: string }>;
|
||||
expect(store[MAIN_SESSION_KEY]?.sendPolicy).toBe("deny");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user