Files
opencode/packages/opencode/test/storage/db.test.ts
2026-04-27 14:33:33 -04:00

15 lines
629 B
TypeScript

import { describe, expect, test } from "bun:test"
import path from "path"
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", () => {
const expected = ["latest", "beta"].includes(InstallationChannel)
? path.join(Global.Path.data, "opencode.db")
: path.join(Global.Path.data, `opencode-${InstallationChannel.replace(/[^a-zA-Z0-9._-]/g, "-")}.db`)
expect(Database.getChannelPath()).toBe(expected)
})
})