Files
t3code/apps/server/src/provider/opencodeRuntime.environment.test.ts
T
2026-08-15 14:27:58 +02:00

24 lines
795 B
TypeScript

import { describe, expect, it } from "vite-plus/test";
import { resolveOpenCodeConfigContent } from "./opencodeRuntime.ts";
describe("resolveOpenCodeConfigContent", () => {
it("prefers the caller environment over the inherited environment", () => {
expect(
resolveOpenCodeConfigContent(
{ OPENCODE_CONFIG_CONTENT: '{"source":"caller"}' },
{ OPENCODE_CONFIG_CONTENT: '{"source":"process"}' },
),
).toBe('{"source":"caller"}');
});
it("falls back to the inherited environment and then an empty config", () => {
expect(
resolveOpenCodeConfigContent(undefined, {
OPENCODE_CONFIG_CONTENT: '{"source":"process"}',
}),
).toBe('{"source":"process"}');
expect(resolveOpenCodeConfigContent(undefined, {})).toBe("{}");
});
});