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

Function TestMetaFilter

monitoring/meta_test.go:10–38  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestMetaFilter(t *testing.T) {
11 // Create a Meta with some test data
12 meta := monitoring.Meta{
13 "key1": "value1",
14 "key2": "value2",
15 "key3": "value3",
16 "key4": 42,
17 }
18
19 // Test filtering with existing keys
20 filtered := meta.Filter("key1", "key3")
21
22 // Check that filtered meta has the correct keys
23 require.Len(t, filtered, 2)
24 require.Equal(t, "value1", filtered["key1"])
25 require.Equal(t, "value3", filtered["key3"])
26
27 // Check that non-requested keys are not present
28 require.NotContains(t, filtered, "key2")
29 require.NotContains(t, filtered, "key4")
30
31 // Test filtering with non-existing keys
32 filtered2 := meta.Filter("nonexistent")
33 require.Empty(t, filtered2)
34
35 // Test filtering with empty parameters
36 filtered3 := meta.Filter()
37 require.Empty(t, filtered3)
38}

Callers

nothing calls this directly

Calls 2

FilterMethod · 0.95
LenMethod · 0.45

Tested by

no test coverage detected