Move the Global module from packages/opencode/src/global to packages/core/src/global to provide a unified location for managing XDG directories and application paths. This eliminates duplicate path definitions across packages and ensures consistent access to data, config, cache, state, log, and bin directories throughout the codebase.
15 lines
634 B
TypeScript
15 lines
634 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 "../../src/storage"
|
|
|
|
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)
|
|
})
|
|
})
|