mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 08:51:42 +00:00
refactor: eliminate remaining duplicate blocks across draft streams and tests
This commit is contained in:
@@ -147,6 +147,13 @@ export function requireSessionStorePath(cfg: { session?: { store?: string } }):
|
||||
return storePath;
|
||||
}
|
||||
|
||||
export async function readSessionStore(cfg: {
|
||||
session?: { store?: string };
|
||||
}): Promise<Record<string, { elevatedLevel?: string }>> {
|
||||
const storeRaw = await fs.readFile(requireSessionStorePath(cfg), "utf-8");
|
||||
return JSON.parse(storeRaw) as Record<string, { elevatedLevel?: string }>;
|
||||
}
|
||||
|
||||
export function makeWhatsAppElevatedCfg(
|
||||
home: string,
|
||||
opts?: { elevatedEnabled?: boolean; requireMentionInGroups?: boolean },
|
||||
@@ -196,8 +203,7 @@ export async function runDirectElevatedToggleAndLoadStore(params: {
|
||||
if (!storePath) {
|
||||
throw new Error("session.store is required in test config");
|
||||
}
|
||||
const storeRaw = await fs.readFile(storePath, "utf-8");
|
||||
const store = JSON.parse(storeRaw) as Record<string, { elevatedLevel?: string }>;
|
||||
const store = await readSessionStore(params.cfg);
|
||||
return { text, store };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user