MCPcopy Index your code
hub / github.com/docker/docker-agent / TestValidate

Function TestValidate

pkg/browser/browser_test.go:10–38  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestValidate(t *testing.T) {
11 t.Parallel()
12
13 for _, tt := range []struct {
14 name string
15 raw string
16 wantErr bool
17 }{
18 {"https", "https://example.com", false},
19 {"http", "http://example.com/path?q=1", false},
20 {"custom scheme deep link", "docker-desktop://dashboard", false},
21 {"mailto", "mailto:a@b.com", false},
22 {"empty", "", true},
23 {"bare path", "foo/bar", true},
24 {"no scheme", "example.com", true},
25 {"leading dash flag", "-foo", true},
26 {"double dash flag", "--version", true},
27 } {
28 t.Run(tt.name, func(t *testing.T) {
29 t.Parallel()
30 err := validate(tt.raw)
31 if tt.wantErr {
32 require.Error(t, err)
33 return
34 }
35 assert.NoError(t, err)
36 })
37 }
38}

Callers

nothing calls this directly

Calls 3

validateFunction · 0.85
RunMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected