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

Function TestNewInvalidKeysError

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

Source from the content-addressed store, hash-verified

59}
60
61func TestNewInvalidKeysError(t *testing.T) {
62
63 tests := []struct {
64 name string
65 invalidKeys map[string]bool
66 wantErr bool
67 }{
68 {
69 name: "No invalid keys",
70 invalidKeys: make(map[string]bool),
71 wantErr: false,
72 },
73 {
74 name: "InvalidKeysError error",
75 invalidKeys: map[string]bool{
76 "key1": true,
77 "key2": true,
78 },
79 wantErr: true,
80 },
81 }
82 for _, tt := range tests {
83 t.Run(tt.name, func(t *testing.T) {
84 err := newInvalidKeysError(tt.invalidKeys)
85 if tt.wantErr && err == nil {
86 t.Errorf("Expected error from test but got nil")
87 } else if !tt.wantErr && err != nil {
88 t.Errorf("Got unexpected error: %s", err)
89 }
90 })
91 }
92}

Callers

nothing calls this directly

Calls 1

newInvalidKeysErrorFunction · 0.85

Tested by

no test coverage detected