MCPcopy Create free account
hub / github.com/devfile/api / TestValidateURI

Function TestValidateURI

pkg/validation/utils_test.go:23–54  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

21)
22
23func TestValidateURI(t *testing.T) {
24
25 tests := []struct {
26 name string
27 uri string
28 wantErr bool
29 }{
30 {
31 name: "Valid URI format starts with http",
32 uri: "http://devfile.yaml",
33 wantErr: false,
34 },
35 {
36 name: "Invalid URI format starts with http",
37 uri: "http//devfile.yaml",
38 wantErr: true,
39 },
40 {
41 name: "Valid URI format does not start with http",
42 uri: "./devfile.yaml",
43 wantErr: false,
44 },
45 }
46 for _, tt := range tests {
47 t.Run(tt.name, func(t *testing.T) {
48 err := ValidateURI(tt.uri)
49 if err != nil && !tt.wantErr {
50 t.Errorf("TestValidateURI error: %v", err)
51 }
52 })
53 }
54}

Callers

nothing calls this directly

Calls 1

ValidateURIFunction · 0.85

Tested by

no test coverage detected