Files
Kilo-Org_kilocode/packages/opencode/test/storage/db.test.ts
T
Mark IJbema 5d5fab36bb fix(cli): repair broken imports and typecheck after opencode v1.14.29 merge
Fixes 257 typecheck errors surfaced after the upstream merge:

- Update imports to new module paths after upstream PR #24554 removed
  module barrel files (@/config, @/session, @/util, etc.) and PR #24309
  renamed @opencode-ai/shared to @opencode-ai/core.
- Migrate loadMode to use Info.zod.safeParse for consistency with
  loadAgents and ConfigCommand (unblocks KilocodeConfig.handleInvalid).
- Drop removed Npm.outdated mock from tests.
- Add missing Config.defaultLayer to bash-permission-metadata test runtime.
- Fix Tips component signature (kilocode drops upstream's 'connected' prop).
- Fix toast.tsx undefined 'duration' reference (should be toastOptions.duration).
- Move filesystem-containment test from deleted shared package to core.
2026-04-30 17:16:31 +02:00

26 lines
1.0 KiB
TypeScript

import { describe, expect, test } from "bun:test"
import path from "path"
import { Flag } from "@opencode-ai/core/flag/flag" // kilocode_change
import { Global } from "@opencode-ai/core/global"
import { InstallationChannel } from "@opencode-ai/core/installation/version"
import { Database } from "@/storage/db"
describe("Database.Path", () => {
test("returns database path for the current channel", () => {
// kilocode_change start — test preload sets KILO_DB=:memory:
if (Flag.KILO_DB) {
const expected =
Flag.KILO_DB === ":memory:" || path.isAbsolute(Flag.KILO_DB)
? Flag.KILO_DB
: path.join(Global.Path.data, Flag.KILO_DB)
expect(Database.Path).toBe(expected)
return
}
// kilocode_change end
const expected = ["latest", "beta"].includes(InstallationChannel)
? path.join(Global.Path.data, "kilo.db")
: path.join(Global.Path.data, `opencode-${InstallationChannel.replace(/[^a-zA-Z0-9._-]/g, "-")}.db`)
expect(Database.getChannelPath()).toBe(expected)
})
})