db.test.ts 634 B

1234567891011121314
  1. import { describe, expect, test } from "bun:test"
  2. import path from "path"
  3. import { Global } from "@opencode-ai/core/global"
  4. import { InstallationChannel } from "@opencode-ai/core/installation/version"
  5. import { Database } from "../../src/storage"
  6. describe("Database.Path", () => {
  7. test("returns database path for the current channel", () => {
  8. const expected = ["latest", "beta"].includes(InstallationChannel)
  9. ? path.join(Global.Path.data, "opencode.db")
  10. : path.join(Global.Path.data, `opencode-${InstallationChannel.replace(/[^a-zA-Z0-9._-]/g, "-")}.db`)
  11. expect(Database.getChannelPath()).toBe(expected)
  12. })
  13. })