(t *testing.T)
| 314 | } |
| 315 | |
| 316 | func 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 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…