Files
openclaw/test/scripts/limit-edge-case-live-proof.test.ts
2026-06-04 20:49:50 -04:00

32 lines
1.2 KiB
TypeScript

// Limit Edge Case Live Proof tests cover limit edge case live proof script behavior.
import { existsSync, mkdtempSync, readdirSync, rmSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import path from "node:path";
import { describe, expect, it } from "vitest";
import { withProofTempRoot } from "../../scripts/repro/limit-edge-case-live-proof.mjs";
import { withEnvAsync } from "../../src/test-utils/env.js";
describe("limit-edge-case live proof", () => {
it("cleans the generated session-log temp root", async () => {
const tempRoot = mkdtempSync(path.join(tmpdir(), "openclaw-limit-proof-test-"));
try {
let proofRoot = "";
await withEnvAsync({ TMPDIR: tempRoot }, async () => {
await withProofTempRoot(async (root) => {
proofRoot = root;
writeFileSync(path.join(root, "s.jsonl"), "{}\n");
expect(existsSync(root)).toBe(true);
});
});
expect(proofRoot).not.toBe("");
expect(existsSync(proofRoot)).toBe(false);
expect(readdirSync(tempRoot).filter((entry) => entry.startsWith("openclaw-proof-"))).toEqual(
[],
);
} finally {
rmSync(tempRoot, { force: true, recursive: true });
}
});
});