From a6de55160257a634dff6514d3e907f723379995b Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Fri, 29 May 2026 17:37:19 +0900 Subject: [PATCH] test(comment-checker): satisfy comment gates in CLI tests Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- src/hooks/comment-checker/cli.test.ts | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/hooks/comment-checker/cli.test.ts b/src/hooks/comment-checker/cli.test.ts index a540aa003..357beacf4 100644 --- a/src/hooks/comment-checker/cli.test.ts +++ b/src/hooks/comment-checker/cli.test.ts @@ -1,3 +1,5 @@ +/// + import { describe, test, expect, mock, afterAll } from "bun:test" import { chmodSync, mkdtempSync, writeFileSync } from "node:fs" import { join } from "node:path" @@ -156,8 +158,9 @@ exit 2 const cliMocks = cliMockFactory() const pendingCall: PendingCall = { tool: "write", - sessionID: "ses-1", + sessionID: "ses-comment-lock-1", filePath: "/tmp/a.ts", + newString: "// new comment", timestamp: Date.now(), } const firstCall = processWithCli({ tool: "write", sessionID: "ses-1", callID: "call-1" }, pendingCall, { output: "" }, "/fake", undefined, () => {}, { runCommentChecker: cliMocks.runCommentChecker }) @@ -183,15 +186,23 @@ exit 2 startBackgroundInit: mock(() => {}), }) const cliMocks = cliMockFactory() - const pendingCall: PendingCall = { + const firstPendingCall: PendingCall = { tool: "write", - sessionID: "ses-1", + sessionID: "ses-comment-after-1", filePath: "/tmp/a.ts", + newString: "// first new comment", + timestamp: Date.now(), + } + const secondPendingCall: PendingCall = { + tool: "write", + sessionID: "ses-comment-after-2", + filePath: "/tmp/b.ts", + newString: "// second new comment", timestamp: Date.now(), } // when - await processWithCli({ tool: "write", sessionID: "ses-1", callID: "call-1" }, pendingCall, { output: "" }, "/fake", undefined, () => {}, { runCommentChecker: cliMocks.runCommentChecker }) - await processWithCli({ tool: "write", sessionID: "ses-2", callID: "call-2" }, pendingCall, { output: "" }, "/fake", undefined, () => {}, { runCommentChecker: cliMocks.runCommentChecker }) + await processWithCli({ tool: "write", sessionID: "ses-comment-after-1", callID: "call-1" }, firstPendingCall, { output: "" }, "/fake", undefined, () => {}, { runCommentChecker: cliMocks.runCommentChecker }) + await processWithCli({ tool: "write", sessionID: "ses-comment-after-2", callID: "call-2" }, secondPendingCall, { output: "" }, "/fake", undefined, () => {}, { runCommentChecker: cliMocks.runCommentChecker }) // then expect(callCount).toBe(2) })