global.test.ts 533 B

12345678910111213141516
  1. import { describe, expect, test } from "bun:test"
  2. import fs from "fs/promises"
  3. import os from "os"
  4. import path from "path"
  5. import { Global } from "@opencode-ai/util/global"
  6. describe("global paths", () => {
  7. test("tmp path is under the system temp directory", () => {
  8. expect(Global.Path.tmp).toBe(path.join(os.tmpdir(), "opencode"))
  9. expect(Global.make().tmp).toBe(Global.Path.tmp)
  10. })
  11. test("tmp path is created on module load", async () => {
  12. expect((await fs.stat(Global.Path.tmp)).isDirectory()).toBe(true)
  13. })
  14. })