test: migrate remaining simple config fixtures

This commit is contained in:
Kit Langton
2026-05-18 21:42:00 -04:00
committed by GitHub
parent 7e4b02f1bf
commit e53563f402
2 changed files with 49 additions and 57 deletions
+22 -31
View File
@@ -157,16 +157,12 @@ async function check(map: (dir: string) => string) {
}
}
test("loads config with defaults when no files exist", async () => {
await using tmp = await tmpdir()
await withTestInstance({
directory: tmp.path,
fn: async (ctx) => {
const config = await load(ctx)
expect(config.username).toBeDefined()
},
})
})
it.instance("loads config with defaults when no files exist", () =>
Effect.gen(function* () {
const config = yield* Config.Service.use((svc) => svc.get())
expect(config.username).toBeDefined()
}),
)
test("creates global jsonc config with schema when no global configs exist", async () => {
await using tmp = await tmpdir()
@@ -346,27 +342,22 @@ test("loads project config from Cygwin paths on Windows", async () => {
})
})
test("ignores legacy tui keys in opencode config", async () => {
await using tmp = await tmpdir({
init: async (dir) => {
await writeConfig(dir, {
$schema: "https://opencode.ai/config.json",
model: "test/model",
theme: "legacy",
tui: { scroll_speed: 4 },
})
},
})
await withTestInstance({
directory: tmp.path,
fn: async (ctx) => {
const config = await load(ctx)
expect(config.model).toBe("test/model")
expect((config as Record<string, unknown>).theme).toBeUndefined()
expect((config as Record<string, unknown>).tui).toBeUndefined()
},
})
})
it.instance("ignores legacy tui keys in opencode config", () =>
Effect.gen(function* () {
const test = yield* TestInstance
yield* writeConfigEffect(test.directory, {
$schema: "https://opencode.ai/config.json",
model: "test/model",
theme: "legacy",
tui: { scroll_speed: 4 },
})
const config = yield* Config.Service.use((svc) => svc.get())
expect(config.model).toBe("test/model")
expect((config as Record<string, unknown>).theme).toBeUndefined()
expect((config as Record<string, unknown>).tui).toBeUndefined()
}),
)
it.instance("loads JSONC config file", () =>
Effect.gen(function* () {