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:
@@ -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(() => {
|
||||
|
||||
Reference in New Issue
Block a user