MCPcopy Create free account
hub / github.com/cli/cli / TestIsJupyterServerURLValid

Function TestIsJupyterServerURLValid

internal/codespaces/rpc/invoker_test.go:316–369  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

314}
315
316func TestIsJupyterServerURLValid(t *testing.T) {
317 tests := []struct {
318 name string
319 serverURL string
320 want bool
321 }{
322 {
323 name: "http loopback IPv4 with token",
324 serverURL: "http://127.0.0.1:1234/lab?token=abc",
325 want: true,
326 },
327 {
328 name: "https localhost",
329 serverURL: "https://localhost:8888/",
330 want: true,
331 },
332 {
333 name: "http loopback IPv6",
334 serverURL: "http://[::1]:9000/lab",
335 want: true,
336 },
337 {
338 name: "vscode-insiders scheme",
339 serverURL: "vscode-insiders://ms-vsliveshare.vsliveshare/join?foo=bar",
340 want: false,
341 },
342 {
343 name: "vscode scheme",
344 serverURL: "vscode://vscode.git/clone?url=https://example.com",
345 want: false,
346 },
347 {
348 name: "non-loopback host",
349 serverURL: "http://cli.github.com/lab",
350 want: false,
351 },
352 {
353 name: "file scheme",
354 serverURL: "file:///mona-home/document",
355 want: false,
356 },
357 {
358 name: "empty string",
359 serverURL: "",
360 want: false,
361 },
362 }
363
364 for _, tt := range tests {
365 t.Run(tt.name, func(t *testing.T) {
366 require.Equal(t, tt.want, isJupyterServerURLValid(tt.serverURL))
367 })
368 }
369}

Callers

nothing calls this directly

Calls 3

isJupyterServerURLValidFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…