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

Function TestCheckForInvalidError

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

Source from the content-addressed store, hash-verified

24)
25
26func TestCheckForInvalidError(t *testing.T) {
27
28 tests := []struct {
29 name string
30 wantInvalidKeys map[string]bool
31 err error
32 }{
33 {
34 name: "No error",
35 wantInvalidKeys: make(map[string]bool),
36 err: nil,
37 },
38 {
39 name: "Different error",
40 wantInvalidKeys: make(map[string]bool),
41 err: fmt.Errorf("an error"),
42 },
43 {
44 name: "InvalidKeysError error",
45 wantInvalidKeys: map[string]bool{
46 "key1": true,
47 "key2": true,
48 },
49 err: &InvalidKeysError{Keys: []string{"key1", "key2"}},
50 },
51 }
52 for _, tt := range tests {
53 t.Run(tt.name, func(t *testing.T) {
54 testMap := make(map[string]bool)
55 checkForInvalidError(testMap, tt.err)
56 assert.Equal(t, tt.wantInvalidKeys, testMap, "the key map should be the same")
57 })
58 }
59}
60
61func TestNewInvalidKeysError(t *testing.T) {
62

Callers

nothing calls this directly

Calls 1

checkForInvalidErrorFunction · 0.85

Tested by

no test coverage detected