forked from cli/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode_test.go
More file actions
50 lines (47 loc) · 1.07 KB
/
code_test.go
File metadata and controls
50 lines (47 loc) · 1.07 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package codespace
import (
"context"
"testing"
"github.com/cli/cli/v2/pkg/cmdutil"
)
func TestApp_VSCode(t *testing.T) {
type args struct {
codespaceName string
useInsiders bool
}
tests := []struct {
name string
args args
wantErr bool
wantURL string
}{
{
name: "open VS Code",
args: args{
codespaceName: "monalisa-cli-cli-abcdef",
useInsiders: false,
},
wantErr: false,
wantURL: "vscode://github.codespaces/connect?name=monalisa-cli-cli-abcdef",
},
{
name: "open VS Code Insiders",
args: args{
codespaceName: "monalisa-cli-cli-abcdef",
useInsiders: true,
},
wantErr: false,
wantURL: "vscode-insiders://github.codespaces/connect?name=monalisa-cli-cli-abcdef",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
b := &cmdutil.TestBrowser{}
a := &App{}
if err := a.VSCode(context.Background(), b, tt.args.codespaceName, tt.args.useInsiders); (err != nil) != tt.wantErr {
t.Errorf("App.VSCode() error = %v, wantErr %v", err, tt.wantErr)
}
b.Verify(t, tt.wantURL)
})
}
}