test(shared): update shared utility tests

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-04-10 15:53:37 +09:00
parent 37057f18b9
commit e7f5d0d5fd
4 changed files with 57 additions and 23 deletions
+9 -2
View File
@@ -1,16 +1,23 @@
/// <reference types="bun-types" />
import { describe, test, expect, beforeEach, afterEach } from "bun:test"
import { getServerBasicAuthHeader, injectServerAuthIntoClient } from "./opencode-server-auth"
let getServerBasicAuthHeader: (typeof import("./opencode-server-auth"))["getServerBasicAuthHeader"]
let injectServerAuthIntoClient: (typeof import("./opencode-server-auth"))["injectServerAuthIntoClient"]
async function importFreshOpencodeServerAuthModule(): Promise<typeof import("./opencode-server-auth")> {
return import(`./opencode-server-auth?test=${Date.now()}-${Math.random()}`)
}
describe("opencode-server-auth", () => {
let originalEnv: Record<string, string | undefined>
beforeEach(() => {
beforeEach(async () => {
originalEnv = {
OPENCODE_SERVER_PASSWORD: process.env.OPENCODE_SERVER_PASSWORD,
OPENCODE_SERVER_USERNAME: process.env.OPENCODE_SERVER_USERNAME,
}
;({ getServerBasicAuthHeader, injectServerAuthIntoClient } = await importFreshOpencodeServerAuthModule())
})
afterEach(() => {