MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / TestNestedMap

Method TestNestedMap

options/options_test.go:280–342  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

278}
279
280func (s *OptionsTestSuite) TestNestedMap() {
281 s.Run("WithoutChildren", func() {
282 o := testOptions()
283
284 expected := map[string]any{
285 "string_key": "string_value",
286 "int_key": 42,
287 "float_key": 3.14,
288 "bool_key": true,
289 "group1": map[string]any{
290 "key1": "value1",
291 "key2": 100,
292 },
293 "group2": map[string]any{
294 "key1": false,
295 "key2": 2.71,
296 "subgroup": map[string]any{
297 "key": "subvalue",
298 "num": 256,
299 },
300 },
301 }
302
303 s.Require().Equal(expected, o.NestedMap())
304 })
305
306 s.Run("WithChildren", func() {
307 o := testNestedOptions()
308
309 expected := map[string]any{
310 "0": map[string]any{
311 "string_key": "string_value",
312 "int_key": 42,
313 "float_key": 3.14,
314 "bool_key": true,
315 "group1": map[string]any{
316 "key1": "value1",
317 "key2": 100,
318 },
319 "group2": map[string]any{
320 "key1": false,
321 "key2": 2.71,
322 "subgroup": map[string]any{
323 "key": "subvalue",
324 "num": 256,
325 },
326 },
327 },
328 "1": map[string]any{
329 "string_key": "child_string_value",
330 "int_key": 84,
331 "child_only_key": "only_in_child",
332 },
333 "2": map[string]any{
334 "string_key": "grandchild_string_value",
335 "int_key": 168,
336 "grandchild_only_key": "only_in_grandchild",
337 },

Callers

nothing calls this directly

Calls 4

testOptionsFunction · 0.85
testNestedOptionsFunction · 0.85
RunMethod · 0.80
NestedMapMethod · 0.80

Tested by

no test coverage detected