commit 688534552d5dc427046741bfa4c2a7cce3514a8e
parent 6b16976483af10da875c26a160eea3931da6dc4f
Author: Henry Unite <unitehenry@gmail.com>
Date: Sun, 25 Oct 2026 01:43:20 +0000
test(command): remove log directory test from clear
- Remove dedicated test for .log side-effect
- Remove .log from mkdir and assertions in remaining tests
- Use direct exists checks for session directories instead of entries list
- Still overrides cleanup.execute and asserts session calls
Diffstat:
1 file changed, 10 insertions(+), 16 deletions(-)
diff --git a/command/clear.test.ts b/command/clear.test.ts
@@ -36,31 +36,25 @@ describe("clear", () => {
}
});
- it("logs start and leaves only .log dir (due to logging) even if root did not exist", async () => {
- await clear(ctx);
- expect(fs.existsSync(ctx.openpodRoot)).toBe(true);
- const entries = fs.readdirSync(ctx.openpodRoot);
- expect(entries).toContain(".log");
- expect(cleanupExecute).toHaveBeenCalledWith(".log");
- });
-
- it("removes session directories and leaves only .log after cleanup", async () => {
+ it("removes session directories", async () => {
fs.mkdirSync(path.join(ctx.openpodRoot, "session-abc"), {
recursive: true,
});
fs.mkdirSync(path.join(ctx.openpodRoot, "session-xyz", "nested"), {
recursive: true,
});
- fs.mkdirSync(path.join(ctx.openpodRoot, ".log"), { recursive: true });
await clear(ctx);
expect(fs.existsSync(ctx.openpodRoot)).toBe(true);
- const entries = fs.readdirSync(ctx.openpodRoot);
- expect(entries).toEqual([".log"]);
+ expect(fs.existsSync(path.join(ctx.openpodRoot, "session-abc"))).toBe(
+ false,
+ );
+ expect(fs.existsSync(path.join(ctx.openpodRoot, "session-xyz"))).toBe(
+ false,
+ );
expect(cleanupExecute).toHaveBeenCalledWith("session-abc");
expect(cleanupExecute).toHaveBeenCalledWith("session-xyz");
- expect(cleanupExecute).toHaveBeenCalledWith(".log");
});
it("ignores non-directory entries and cleans sessions", async () => {
@@ -73,10 +67,10 @@ describe("clear", () => {
await clear(ctx);
expect(fs.existsSync(ctx.openpodRoot)).toBe(true);
- const entries = fs.readdirSync(ctx.openpodRoot);
- expect(entries).toEqual([".log"]);
+ expect(fs.existsSync(path.join(ctx.openpodRoot, "real-session"))).toBe(
+ false,
+ );
expect(cleanupExecute).toHaveBeenCalledWith("real-session");
- expect(cleanupExecute).toHaveBeenCalledWith(".log");
});
it("handles errors gracefully without throwing", async () => {