forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathredeploy-env.token.test.ts
More file actions
32 lines (30 loc) · 1.2 KB
/
Copy pathredeploy-env.token.test.ts
File metadata and controls
32 lines (30 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { describe, expect, it, vi } from "vitest";
import { resolveRailwayTokenFromConfig } from "../lib/railway-token";
// Characterization test: pins the resolver contract that redeploy-env's
// getToken path will use after E-2d. The resolver itself was proven
// red-green in E-2a/E-2b; this test exists so a future change to the
// resolver that breaks the redeploy-env consumer surfaces here too.
// EXPECTED OUTCOME: PASS on first run (resolver already exists). This is
// intentional — see the step header. Do NOT relabel this as a RED step.
describe("redeploy-env token resolution contract", () => {
it("returns accessToken from a typical post-login config", () => {
const warn = vi.fn();
expect(
resolveRailwayTokenFromConfig(
{ user: { accessToken: "abc-access-aaaaaaaaaaaaa" } },
{ warn },
),
).toBe("abc-access-aaaaaaaaaaaaa");
expect(warn).not.toHaveBeenCalled();
});
it("warns when only user.token (legacy) is present", () => {
const warn = vi.fn();
expect(
resolveRailwayTokenFromConfig(
{ user: { token: "legacy-xxxxxxxxxx" } },
{ warn },
),
).toBe("legacy-xxxxxxxxxx");
expect(warn).toHaveBeenCalledOnce();
});
});