MCPcopy Create free account
hub / github.com/github/gh-aw / TestExcludeMapKeys

Function TestExcludeMapKeys

pkg/workflow/map_helpers_test.go:147–250  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

145}
146
147func TestExcludeMapKeys(t *testing.T) {
148 tests := []struct {
149 name string
150 original map[string]any
151 excludeKeys []string
152 expected map[string]any
153 }{
154 {
155 name: "filter single key",
156 original: map[string]any{
157 "key1": "value1",
158 "key2": "value2",
159 "key3": "value3",
160 },
161 excludeKeys: []string{"key2"},
162 expected: map[string]any{
163 "key1": "value1",
164 "key3": "value3",
165 },
166 },
167 {
168 name: "filter multiple keys",
169 original: map[string]any{
170 "key1": "value1",
171 "key2": "value2",
172 "key3": "value3",
173 "key4": "value4",
174 },
175 excludeKeys: []string{"key1", "key3"},
176 expected: map[string]any{
177 "key2": "value2",
178 "key4": "value4",
179 },
180 },
181 {
182 name: "filter no keys",
183 original: map[string]any{
184 "key1": "value1",
185 "key2": "value2",
186 },
187 excludeKeys: []string{},
188 expected: map[string]any{
189 "key1": "value1",
190 "key2": "value2",
191 },
192 },
193 {
194 name: "filter non-existent key",
195 original: map[string]any{
196 "key1": "value1",
197 "key2": "value2",
198 },
199 excludeKeys: []string{"key3"},
200 expected: map[string]any{
201 "key1": "value1",
202 "key2": "value2",
203 },
204 },

Callers

nothing calls this directly

Calls 3

excludeMapKeysFunction · 0.85
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected