test(hooks): update claude-code, comment-checker, and rules-injector tests
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -3,6 +3,7 @@ import { chmodSync, mkdtempSync, writeFileSync } from "node:fs"
|
||||
import { join } from "node:path"
|
||||
import { tmpdir } from "node:os"
|
||||
|
||||
import { processWithCli } from "./cli-runner"
|
||||
import type { PendingCall } from "./types"
|
||||
|
||||
function createMockInput() {
|
||||
@@ -151,20 +152,15 @@ exit 2
|
||||
getCommentCheckerPath: mock(async () => "/fake"),
|
||||
startBackgroundInit: mock(() => {}),
|
||||
})
|
||||
mock.module("./cli", cliMockFactory)
|
||||
mock.module("./cli.ts", cliMockFactory)
|
||||
mock.module(new URL("./cli.ts", import.meta.url).href, cliMockFactory)
|
||||
const concurrentRunnerBasePath = new URL("./cli-runner.ts", import.meta.url).pathname
|
||||
const concurrentModulePath = `${concurrentRunnerBasePath}?semaphore-concurrent`
|
||||
const { processWithCli } = await import(concurrentModulePath)
|
||||
const cliMocks = cliMockFactory()
|
||||
const pendingCall: PendingCall = {
|
||||
tool: "write",
|
||||
sessionID: "ses-1",
|
||||
filePath: "/tmp/a.ts",
|
||||
timestamp: Date.now(),
|
||||
}
|
||||
const firstCall = processWithCli({ tool: "write", sessionID: "ses-1", callID: "call-1" }, pendingCall, { output: "" }, "/fake", undefined, () => {})
|
||||
const secondCall = processWithCli({ tool: "write", sessionID: "ses-2", callID: "call-2" }, pendingCall, { output: "" }, "/fake", undefined, () => {})
|
||||
const firstCall = processWithCli({ tool: "write", sessionID: "ses-1", callID: "call-1" }, pendingCall, { output: "" }, "/fake", undefined, () => {}, { runCommentChecker: cliMocks.runCommentChecker })
|
||||
const secondCall = processWithCli({ tool: "write", sessionID: "ses-2", callID: "call-2" }, pendingCall, { output: "" }, "/fake", undefined, () => {}, { runCommentChecker: cliMocks.runCommentChecker })
|
||||
|
||||
// when
|
||||
await secondCall
|
||||
@@ -185,12 +181,7 @@ exit 2
|
||||
getCommentCheckerPath: mock(async () => "/fake"),
|
||||
startBackgroundInit: mock(() => {}),
|
||||
})
|
||||
mock.module("./cli", cliMockFactory)
|
||||
mock.module("./cli.ts", cliMockFactory)
|
||||
mock.module(new URL("./cli.ts", import.meta.url).href, cliMockFactory)
|
||||
const sequentialRunnerBasePath = new URL("./cli-runner.ts", import.meta.url).pathname
|
||||
const sequentialModulePath = `${sequentialRunnerBasePath}?semaphore-sequential`
|
||||
const { processWithCli } = await import(sequentialModulePath)
|
||||
const cliMocks = cliMockFactory()
|
||||
const pendingCall: PendingCall = {
|
||||
tool: "write",
|
||||
sessionID: "ses-1",
|
||||
@@ -198,8 +189,8 @@ exit 2
|
||||
timestamp: Date.now(),
|
||||
}
|
||||
// when
|
||||
await processWithCli({ tool: "write", sessionID: "ses-1", callID: "call-1" }, pendingCall, { output: "" }, "/fake", undefined, () => {})
|
||||
await processWithCli({ tool: "write", sessionID: "ses-2", callID: "call-2" }, pendingCall, { output: "" }, "/fake", undefined, () => {})
|
||||
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 })
|
||||
// then
|
||||
expect(callCount).toBe(2)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user