Skip to content
Source
Sign inSign up

triageTarget.test.ts

27 lines772 Bytes

1import { describe, expect, it } from "vite-plus/test";
2​
3import { pickTriageEnvironment } from "./triageTarget";
4​
5describe("pickTriageEnvironment", () => {
6 it("skips a primary machine whose server lacks triage", () => {
7 expect(
8 pickTriageEnvironment({
9 onScreen: null,
10 primary: "old-primary",
11 connected: ["old-primary", "new-remote"],
12 supportsTriage: (environmentId) => environmentId === "new-remote",
13 }),
14 ).toBe("new-remote");
15 });
16​
17 it("prefers a capable primary over other capable machines", () => {
18 expect(
19 pickTriageEnvironment({
20 onScreen: null,
21 primary: "primary",
22 connected: ["remote", "primary"],
23 supportsTriage: () => true,
24 }),
25 ).toBe("primary");
26 });
27});