The best way to control Claude Code, Codex and more from any computer or phone

main
ts 60 lines 1.3 KB
Raw
1 import type { DesktopDiscoveredSshHost } from "@t3tools/contracts";
2 import { describe, expect, it } from "vite-plus/test";
3
4 import { filterDiscoveredSshHosts } from "./desktopSshHosts";
5
6 describe("filterDiscoveredSshHosts", () => {
7 const suggestions: ReadonlyArray<DesktopDiscoveredSshHost> = [
8 {
9 alias: "grape",
10 hostname: "grape",
11 port: null,
12 source: "known-hosts",
13 username: null,
14 },
15 {
16 alias: "Pinot",
17 hostname: "Pinot",
18 port: null,
19 source: "ssh-config",
20 username: null,
21 },
22 {
23 alias: "preprod",
24 hostname: "preprod",
25 port: 2222,
26 source: "ssh-config",
27 username: "deploy",
28 },
29 {
30 alias: "prod-z",
31 hostname: "prod-z",
32 port: null,
33 source: "ssh-config",
34 username: null,
35 },
36 {
37 alias: "prod-a",
38 hostname: "prod-a",
39 port: null,
40 source: "ssh-config",
41 username: null,
42 },
43 {
44 alias: "prod-m",
45 hostname: "prod-m",
46 port: null,
47 source: "ssh-config",
48 username: null,
49 },
50 ];
51
52 it("ranks alias prefix matches before substring matches", () => {
53 expect(filterDiscoveredSshHosts(suggestions, "prod")).toEqual([
54 suggestions[3],
55 suggestions[4],
56 suggestions[5],
57 suggestions[2],
58 ]);
59 });
60 });