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

OpenCodeRuntime.environment.test.ts

27 lines880 Bytes

1import { describe, expect, it } from "vite-plus/test";
2​
3import * as OpenCodeRuntime from "./OpenCodeRuntime.ts";
4​
5describe("resolveOpenCodeServerPassword", () => {
6 it("uses the settings password when local settings and environment differ", () => {
7 expect(
8 OpenCodeRuntime.resolveOpenCodeServerPassword(
9 {
10 external: false,
11 serverPassword: "settings-password",
12 environment: { OPENCODE_SERVER_PASSWORD: "environment-password" },
13 },
14 {},
15 ),
16 ).toBe("settings-password");
17 });
18​
19 it("does not send an inherited local password to an external server", () => {
20 expect(
21 OpenCodeRuntime.resolveOpenCodeServerPassword(
22 { external: true, environment: { OPENCODE_SERVER_PASSWORD: "local-secret" } },
23 { OPENCODE_SERVER_PASSWORD: "inherited-secret" },
24 ),
25 ).toBeUndefined();
26 });
27});