test(atlas): reset session state instead of module mocking
This commit is contained in:
parent
e7dc3721df
commit
37d3086658
@ -10,18 +10,9 @@ import {
|
|||||||
} from "../../features/boulder-state"
|
} from "../../features/boulder-state"
|
||||||
import type { BoulderState } from "../../features/boulder-state"
|
import type { BoulderState } from "../../features/boulder-state"
|
||||||
|
|
||||||
const TEST_STORAGE_ROOT = join(tmpdir(), `atlas-message-storage-${randomUUID()}`)
|
import { MESSAGE_STORAGE } from "../../features/hook-message-injector"
|
||||||
const TEST_MESSAGE_STORAGE = join(TEST_STORAGE_ROOT, "message")
|
import { _resetForTesting, subagentSessions } from "../../features/claude-code-session-state"
|
||||||
const TEST_PART_STORAGE = join(TEST_STORAGE_ROOT, "part")
|
import { createAtlasHook } from "./index"
|
||||||
|
|
||||||
mock.module("../../features/hook-message-injector/constants", () => ({
|
|
||||||
OPENCODE_STORAGE: TEST_STORAGE_ROOT,
|
|
||||||
MESSAGE_STORAGE: TEST_MESSAGE_STORAGE,
|
|
||||||
PART_STORAGE: TEST_PART_STORAGE,
|
|
||||||
}))
|
|
||||||
|
|
||||||
const { createAtlasHook } = await import("./index")
|
|
||||||
const { MESSAGE_STORAGE } = await import("../../features/hook-message-injector")
|
|
||||||
|
|
||||||
describe("atlas hook", () => {
|
describe("atlas hook", () => {
|
||||||
let TEST_DIR: string
|
let TEST_DIR: string
|
||||||
@ -77,7 +68,6 @@ describe("atlas hook", () => {
|
|||||||
if (existsSync(TEST_DIR)) {
|
if (existsSync(TEST_DIR)) {
|
||||||
rmSync(TEST_DIR, { recursive: true, force: true })
|
rmSync(TEST_DIR, { recursive: true, force: true })
|
||||||
}
|
}
|
||||||
rmSync(TEST_STORAGE_ROOT, { recursive: true, force: true })
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("tool.execute.after handler", () => {
|
describe("tool.execute.after handler", () => {
|
||||||
@ -631,15 +621,14 @@ describe("atlas hook", () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mock.module("../../features/claude-code-session-state", () => ({
|
_resetForTesting()
|
||||||
getMainSessionID: () => MAIN_SESSION_ID,
|
subagentSessions.clear()
|
||||||
subagentSessions: new Set<string>(),
|
|
||||||
}))
|
|
||||||
setupMessageStorage(MAIN_SESSION_ID, "atlas")
|
setupMessageStorage(MAIN_SESSION_ID, "atlas")
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
cleanupMessageStorage(MAIN_SESSION_ID)
|
cleanupMessageStorage(MAIN_SESSION_ID)
|
||||||
|
_resetForTesting()
|
||||||
})
|
})
|
||||||
|
|
||||||
test("should inject continuation when boulder has incomplete tasks", async () => {
|
test("should inject continuation when boulder has incomplete tasks", async () => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user