Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

opencodeRuntime.environment.test.ts

23 lines795 Bytes

1import { describe, expect, it } from "vite-plus/test";
2​
3import { resolveOpenCodeConfigContent } from "./opencodeRuntime.ts";
4​
5describe("resolveOpenCodeConfigContent", () => {
6 it("prefers the caller environment over the inherited environment", () => {
7 expect(
8 resolveOpenCodeConfigContent(
9 { OPENCODE_CONFIG_CONTENT: '{"source":"caller"}' },
10 { OPENCODE_CONFIG_CONTENT: '{"source":"process"}' },
11 ),
12 ).toBe('{"source":"caller"}');
13 });
14​
15 it("falls back to the inherited environment and then an empty config", () => {
16 expect(
17 resolveOpenCodeConfigContent(undefined, {
18 OPENCODE_CONFIG_CONTENT: '{"source":"process"}',
19 }),
20 ).toBe('{"source":"process"}');
21 expect(resolveOpenCodeConfigContent(undefined, {})).toBe("{}");
22 });
23});