chore: refactoring and tests, splitting up files (#12495)

This commit is contained in:
Adam
2026-02-06 10:02:31 -06:00
committed by GitHub
parent a4bc883595
commit 2c58dd6203
117 changed files with 9457 additions and 5827 deletions

View File

@@ -1,33 +1,13 @@
import { afterEach, beforeAll, describe, expect, mock, test } from "bun:test"
let evictContentLru: (keep: Set<string> | undefined, evict: (path: string) => void) => void
let getFileContentBytesTotal: () => number
let getFileContentEntryCount: () => number
let removeFileContentBytes: (path: string) => void
let resetFileContentLru: () => void
let setFileContentBytes: (path: string, bytes: number) => void
let touchFileContent: (path: string, bytes?: number) => void
beforeAll(async () => {
mock.module("@solidjs/router", () => ({
useParams: () => ({}),
}))
mock.module("@opencode-ai/ui/context", () => ({
createSimpleContext: () => ({
use: () => undefined,
provider: () => undefined,
}),
}))
const mod = await import("./file")
evictContentLru = mod.evictContentLru
getFileContentBytesTotal = mod.getFileContentBytesTotal
getFileContentEntryCount = mod.getFileContentEntryCount
removeFileContentBytes = mod.removeFileContentBytes
resetFileContentLru = mod.resetFileContentLru
setFileContentBytes = mod.setFileContentBytes
touchFileContent = mod.touchFileContent
})
import { afterEach, describe, expect, test } from "bun:test"
import {
evictContentLru,
getFileContentBytesTotal,
getFileContentEntryCount,
removeFileContentBytes,
resetFileContentLru,
setFileContentBytes,
touchFileContent,
} from "./file/content-cache"
describe("file content eviction accounting", () => {
afterEach(() => {