summaryrefslogtreecommitdiffhomepage
path: root/packages/core/test/global.test.ts
blob: 4e13e8842430d4b5459f54791934476e955502f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { describe, expect, test } from "bun:test"
import fs from "fs/promises"
import os from "os"
import path from "path"
import { Global } from "@opencode-ai/core/global"

describe("global paths", () => {
  test("tmp path is under the system temp directory", () => {
    expect(Global.Path.tmp).toBe(path.join(os.tmpdir(), "opencode"))
    expect(Global.make().tmp).toBe(Global.Path.tmp)
  })

  test("tmp path is created on module load", async () => {
    expect((await fs.stat(Global.Path.tmp)).isDirectory()).toBe(true)
  })
})