test(shared): cover detectPluginConfigFile memoization

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-04-18 14:12:50 +09:00
parent 49c7d4dbf9
commit 948343ab66
2 changed files with 64 additions and 2 deletions
+10 -2
View File
@@ -1,5 +1,5 @@
import { describe, expect, test } from "bun:test"
import { detectConfigFile, detectPluginConfigFile, parseJsonc, parseJsoncSafe, readJsoncFile } from "./jsonc-parser"
import { afterEach, beforeEach, describe, expect, test } from "bun:test"
import { clearPluginConfigFileDetectionCache, detectConfigFile, detectPluginConfigFile, parseJsonc, parseJsoncSafe, readJsoncFile } from "./jsonc-parser"
import { existsSync, mkdirSync, rmSync, writeFileSync } from "node:fs"
import { join } from "node:path"
@@ -330,6 +330,14 @@ describe("detectConfigFile", () => {
describe("detectPluginConfigFile", () => {
const testDir = join(__dirname, ".test-detect-plugin")
beforeEach(() => {
clearPluginConfigFileDetectionCache()
})
afterEach(() => {
clearPluginConfigFileDetectionCache()
})
test("prefers oh-my-openagent over oh-my-opencode when both jsonc files exist", () => {
// given
if (!existsSync(testDir)) mkdirSync(testDir, { recursive: true })