1- import { it , expect } from "vitest" ;
1+ import { describe , it , expect } from "vitest" ;
22
33import {
44 computeSshProperties ,
@@ -26,10 +26,11 @@ it("current shell supports ssh", () => {
2626 expect ( sshSupportsSetEnv ( ) ) . toBeTruthy ( ) ;
2727} ) ;
2828
29- it ( "computes the config for a host" , ( ) => {
30- const properties = computeSshProperties (
31- "coder-vscode--testing" ,
32- `Host *
29+ describe ( "computeSshProperties" , ( ) => {
30+ it ( "computes the config for a host" , ( ) => {
31+ const properties = computeSshProperties (
32+ "coder-vscode--testing" ,
33+ `Host *
3334 StrictHostKeyChecking yes
3435
3536# --- START CODER VSCODE ---
@@ -39,19 +40,19 @@ Host coder-vscode--*
3940 ProxyCommand=/tmp/coder --header="X-FOO=bar" coder.dev
4041# --- END CODER VSCODE ---
4142` ,
42- ) ;
43+ ) ;
4344
44- expect ( properties ) . toEqual ( {
45- Another : "true" ,
46- StrictHostKeyChecking : "yes" ,
47- ProxyCommand : '/tmp/coder --header="X-FOO=bar" coder.dev' ,
45+ expect ( properties ) . toEqual ( {
46+ Another : "true" ,
47+ StrictHostKeyChecking : "yes" ,
48+ ProxyCommand : '/tmp/coder --header="X-FOO=bar" coder.dev' ,
49+ } ) ;
4850 } ) ;
49- } ) ;
5051
51- it ( "handles ? wildcards" , ( ) => {
52- const properties = computeSshProperties (
53- "coder-vscode--testing" ,
54- `Host *
52+ it ( "handles ? wildcards" , ( ) => {
53+ const properties = computeSshProperties (
54+ "coder-vscode--testing" ,
55+ `Host *
5556 StrictHostKeyChecking yes
5657
5758Host i-???????? i-?????????????????
@@ -67,19 +68,19 @@ Host coder-v?code--*
6768 ProxyCommand=/tmp/coder --header="X-BAR=foo" coder.dev
6869# --- END CODER VSCODE ---
6970` ,
70- ) ;
71+ ) ;
7172
72- expect ( properties ) . toEqual ( {
73- Another : "true" ,
74- StrictHostKeyChecking : "yes" ,
75- ProxyCommand : '/tmp/coder --header="X-BAR=foo" coder.dev' ,
73+ expect ( properties ) . toEqual ( {
74+ Another : "true" ,
75+ StrictHostKeyChecking : "yes" ,
76+ ProxyCommand : '/tmp/coder --header="X-BAR=foo" coder.dev' ,
77+ } ) ;
7678 } ) ;
77- } ) ;
7879
79- it ( "picks up RemoteCommand from a user Host block alongside a Coder block" , ( ) => {
80- const props = computeSshProperties (
81- "coder-vscode.example.com--user--ws" ,
82- `# --- START CODER VSCODE example.com ---
80+ it ( "picks up RemoteCommand from a user Host block alongside a Coder block" , ( ) => {
81+ const props = computeSshProperties (
82+ "coder-vscode.example.com--user--ws" ,
83+ `# --- START CODER VSCODE example.com ---
8384Host coder-vscode.example.com--*
8485 ProxyCommand /path/to/coder ssh --stdio %h
8586 StrictHostKeyChecking no
@@ -89,48 +90,48 @@ Host coder-vscode.example.com--*
8990 RequestTTY yes
9091 RemoteCommand exec /bin/bash -l
9192` ,
92- ) ;
93- expect ( props . RemoteCommand ) . toBe ( "exec /bin/bash -l" ) ;
94- expect ( props . ProxyCommand ) . toBe ( "/path/to/coder ssh --stdio %h" ) ;
95- } ) ;
93+ ) ;
94+ expect ( props . RemoteCommand ) . toBe ( "exec /bin/bash -l" ) ;
95+ expect ( props . ProxyCommand ) . toBe ( "/path/to/coder ssh --stdio %h" ) ;
96+ } ) ;
9697
97- it ( "returns RemoteCommand none literally" , ( ) => {
98- const props = computeSshProperties (
99- "coder-vscode.example.com--user--ws" ,
100- `Host coder-vscode.example.com--*
98+ it ( "returns RemoteCommand none literally" , ( ) => {
99+ const props = computeSshProperties (
100+ "coder-vscode.example.com--user--ws" ,
101+ `Host coder-vscode.example.com--*
101102 RemoteCommand none
102103` ,
103- ) ;
104- expect ( props . RemoteCommand ) . toBe ( "none" ) ;
105- } ) ;
104+ ) ;
105+ expect ( props . RemoteCommand ) . toBe ( "none" ) ;
106+ } ) ;
106107
107- it ( "inherits RemoteCommand from a Host * block" , ( ) => {
108- const props = computeSshProperties (
109- "coder-vscode.example.com--user--ws" ,
110- `Host *
108+ it ( "inherits RemoteCommand from a Host * block" , ( ) => {
109+ const props = computeSshProperties (
110+ "coder-vscode.example.com--user--ws" ,
111+ `Host *
111112 RemoteCommand exec /bin/zsh -l
112113
113114Host coder-vscode.example.com--*
114115 ProxyCommand /path/to/coder ssh --stdio %h
115116` ,
116- ) ;
117- expect ( props . RemoteCommand ) . toBe ( "exec /bin/zsh -l" ) ;
118- } ) ;
117+ ) ;
118+ expect ( props . RemoteCommand ) . toBe ( "exec /bin/zsh -l" ) ;
119+ } ) ;
119120
120- it ( "handles RemoteCommand with = delimiter" , ( ) => {
121- const props = computeSshProperties (
122- "coder-vscode.example.com--user--ws" ,
123- `Host coder-vscode.example.com--*
121+ it ( "handles RemoteCommand with = delimiter" , ( ) => {
122+ const props = computeSshProperties (
123+ "coder-vscode.example.com--user--ws" ,
124+ `Host coder-vscode.example.com--*
124125 RemoteCommand=exec /bin/bash -l
125126` ,
126- ) ;
127- expect ( props . RemoteCommand ) . toBe ( "exec /bin/bash -l" ) ;
128- } ) ;
127+ ) ;
128+ expect ( props . RemoteCommand ) . toBe ( "exec /bin/bash -l" ) ;
129+ } ) ;
129130
130- it ( "properly escapes meaningful regex characters" , ( ) => {
131- const properties = computeSshProperties (
132- "coder-vscode.dev.coder.com--matalfi--dogfood" ,
133- `Host *
131+ it ( "properly escapes meaningful regex characters" , ( ) => {
132+ const properties = computeSshProperties (
133+ "coder-vscode.dev.coder.com--matalfi--dogfood" ,
134+ `Host *
134135 StrictHostKeyChecking yes
135136
136137# ------------START-CODER-----------
@@ -153,12 +154,13 @@ Host coder-vscode.dev.coder.com--*
153154# --- END CODER VSCODE dev.coder.com ---%
154155
155156` ,
156- ) ;
157-
158- expect ( properties ) . toEqual ( {
159- StrictHostKeyChecking : "yes" ,
160- ProxyCommand :
161- '"/Users/matifali/Library/Application Support/Code/User/globalStorage/coder.coder-remote/dev.coder.com/bin/coder-darwin-arm64" vscodessh --network-info-dir "/Users/matifali/Library/Application Support/Code/User/globalStorage/coder.coder-remote/net" --session-token-file "/Users/matifali/Library/Application Support/Code/User/globalStorage/coder.coder-remote/dev.coder.com/session" --url-file "/Users/matifali/Library/Application Support/Code/User/globalStorage/coder.coder-remote/dev.coder.com/url" %h' ,
162- UserKnownHostsFile : "/dev/null" ,
157+ ) ;
158+
159+ expect ( properties ) . toEqual ( {
160+ StrictHostKeyChecking : "yes" ,
161+ ProxyCommand :
162+ '"/Users/matifali/Library/Application Support/Code/User/globalStorage/coder.coder-remote/dev.coder.com/bin/coder-darwin-arm64" vscodessh --network-info-dir "/Users/matifali/Library/Application Support/Code/User/globalStorage/coder.coder-remote/net" --session-token-file "/Users/matifali/Library/Application Support/Code/User/globalStorage/coder.coder-remote/dev.coder.com/session" --url-file "/Users/matifali/Library/Application Support/Code/User/globalStorage/coder.coder-remote/dev.coder.com/url" %h' ,
163+ UserKnownHostsFile : "/dev/null" ,
164+ } ) ;
163165 } ) ;
164166} ) ;
0 commit comments