MCPcopy Index your code
hub / github.com/coder/coder / Test_buildAppLinkURL

Function Test_buildAppLinkURL

cli/open_internal_test.go:65–167  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

63}
64
65func Test_buildAppLinkURL(t *testing.T) {
66 t.Parallel()
67
68 for _, tt := range []struct {
69 name string
70 // function arguments
71 baseURL string
72 workspace codersdk.Workspace
73 agent codersdk.WorkspaceAgent
74 app codersdk.WorkspaceApp
75 appsHost string
76 preferredPathBase string
77 // expected results
78 expectedLink string
79 }{
80 {
81 name: "external url",
82 baseURL: "https://coder.tld",
83 app: codersdk.WorkspaceApp{
84 External: true,
85 URL: "https://external-url.tld",
86 },
87 expectedLink: "https://external-url.tld",
88 },
89 {
90 name: "without subdomain",
91 baseURL: "https://coder.tld",
92 workspace: codersdk.Workspace{
93 Name: "Test-Workspace",
94 OwnerName: "username",
95 },
96 agent: codersdk.WorkspaceAgent{
97 Name: "a-workspace-agent",
98 },
99 app: codersdk.WorkspaceApp{
100 Slug: "app-slug",
101 Subdomain: false,
102 },
103 preferredPathBase: "/path-base",
104 expectedLink: "https://coder.tld/path-base/@username/Test-Workspace.a-workspace-agent/apps/app-slug/",
105 },
106 {
107 name: "with command",
108 baseURL: "https://coder.tld",
109 workspace: codersdk.Workspace{
110 Name: "Test-Workspace",
111 OwnerName: "username",
112 },
113 agent: codersdk.WorkspaceAgent{
114 Name: "a-workspace-agent",
115 },
116 app: codersdk.WorkspaceApp{
117 Slug: "my-terminal",
118 Command: "ls -la",
119 },
120 expectedLink: "https://coder.tld/@username/Test-Workspace.a-workspace-agent/terminal?app=my-terminal",
121 },
122 {

Callers

nothing calls this directly

Calls 4

buildAppLinkURLFunction · 0.85
RunMethod · 0.65
ParseMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected