@@ -21,7 +21,23 @@ describe("getAppHref", () => {
21
21
expect ( href ) . toBe ( externalApp . url ) ;
22
22
} ) ;
23
23
24
- it ( "returns the URL with the session token replaced when external app needs session token " , ( ) => {
24
+ it ( "returns the URL with the session token replaced when external app needs session token" , ( ) => {
25
+ const externalApp = {
26
+ ...MockWorkspaceApp ,
27
+ external : true ,
28
+ url : `vscode://example.com?token=${ SESSION_TOKEN_PLACEHOLDER } ` ,
29
+ } ;
30
+ const href = getAppHref ( externalApp , {
31
+ host : "*.apps-host.tld" ,
32
+ path : "/path-base" ,
33
+ agent : MockWorkspaceAgent ,
34
+ workspace : MockWorkspace ,
35
+ token : "user-session-token" ,
36
+ } ) ;
37
+ expect ( href ) . toBe ( "vscode://example.com?token=user-session-token" ) ;
38
+ } ) ;
39
+
40
+ it ( "doesn't return the URL with the session token replaced when using the HTTP protocol" , ( ) => {
25
41
const externalApp = {
26
42
...MockWorkspaceApp ,
27
43
external : true ,
@@ -34,7 +50,7 @@ describe("getAppHref", () => {
34
50
workspace : MockWorkspace ,
35
51
token : "user-session-token" ,
36
52
} ) ;
37
- expect ( href ) . toBe ( "https://example.com?token=user-session-token" ) ;
53
+ expect ( href ) . toBe ( externalApp . url ) ;
38
54
} ) ;
39
55
40
56
it ( "returns a path when app doesn't use a subdomain" , ( ) => {
@@ -49,7 +65,7 @@ describe("getAppHref", () => {
49
65
path : "/path-base" ,
50
66
} ) ;
51
67
expect ( href ) . toBe (
52
- " /path-base/@username /Test-Workspace.a-workspace-agent/apps/app- slug/" ,
68
+ ` /path-base/@${ MockWorkspace . owner_name } /Test-Workspace.a-workspace-agent/apps/${ app . slug } /` ,
53
69
) ;
54
70
} ) ;
55
71
@@ -62,10 +78,10 @@ describe("getAppHref", () => {
62
78
host : "*.apps-host.tld" ,
63
79
agent : MockWorkspaceAgent ,
64
80
workspace : MockWorkspace ,
65
- path : "/path-base " ,
81
+ path : "" ,
66
82
} ) ;
67
83
expect ( href ) . toBe (
68
- "/path-base/@username /Test-Workspace.a-workspace-agent/terminal?command=ls%20-la" ,
84
+ `/@ ${ MockWorkspace . owner_name } /Test-Workspace.a-workspace-agent/terminal?command=ls%20-la` ,
69
85
) ;
70
86
} ) ;
71
87
@@ -81,7 +97,7 @@ describe("getAppHref", () => {
81
97
workspace : MockWorkspace ,
82
98
path : "/path-base" ,
83
99
} ) ;
84
- expect ( href ) . toBe ( "https ://hellocoder.apps-host.tld/" ) ;
100
+ expect ( href ) . toBe ( "http ://hellocoder.apps-host.tld/" ) ;
85
101
} ) ;
86
102
87
103
it ( "returns a path when app has a subdomain but no subdomain name" , ( ) => {
@@ -97,7 +113,7 @@ describe("getAppHref", () => {
97
113
path : "/path-base" ,
98
114
} ) ;
99
115
expect ( href ) . toBe (
100
- " /path-base/@username /Test-Workspace.a-workspace-agent/apps/app- slug/" ,
116
+ ` /path-base/@${ MockWorkspace . owner_name } /Test-Workspace.a-workspace-agent/apps/${ app . slug } /` ,
101
117
) ;
102
118
} ) ;
103
119
} ) ;
0 commit comments