mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-12 05:53:51 +00:00
test(cron): improve fire-and-forget harness coverage
This commit is contained in:
@@ -51,6 +51,22 @@ export function createCronStoreHarness(options?: { prefix?: string }) {
|
||||
return { makeStorePath };
|
||||
}
|
||||
|
||||
export async function writeCronStoreSnapshot(params: { storePath: string; jobs: CronJob[] }) {
|
||||
await fs.mkdir(path.dirname(params.storePath), { recursive: true });
|
||||
await fs.writeFile(
|
||||
params.storePath,
|
||||
JSON.stringify(
|
||||
{
|
||||
version: 1,
|
||||
jobs: params.jobs,
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
"utf-8",
|
||||
);
|
||||
}
|
||||
|
||||
export function installCronTestHooks(options: {
|
||||
logger: ReturnType<typeof createNoopLogger>;
|
||||
baseTimeIso?: string;
|
||||
|
||||
Reference in New Issue
Block a user