(t *testing.T)
| 24 | ) |
| 25 | |
| 26 | func 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 | |
| 61 | func TestNewInvalidKeysError(t *testing.T) { |
| 62 |
nothing calls this directly
no test coverage detected