MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / TestMergeMetadata

Function TestMergeMetadata

metadata_test.go:129–164  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

127}
128
129func TestMergeMetadata(t *testing.T) {
130 tests := []struct {
131 name string
132 current map[string]interface{}
133 new map[string]interface{}
134 expected map[string]interface{}
135 }{
136 {
137 name: "Merge with empty current",
138 current: nil,
139 new: map[string]interface{}{"new": "value"},
140 expected: map[string]interface{}{"new": "value"},
141 },
142 {
143 name: "Merge with existing values",
144 current: map[string]interface{}{"existing": "value"},
145 new: map[string]interface{}{"new": "value"},
146 expected: map[string]interface{}{"existing": "value", "new": "value"},
147 },
148 {
149 name: "Override existing values",
150 current: map[string]interface{}{"key": "old"},
151 new: map[string]interface{}{"key": "new"},
152 expected: map[string]interface{}{
153 "key": "new",
154 },
155 },
156 }
157
158 for _, tt := range tests {
159 t.Run(tt.name, func(t *testing.T) {
160 result := mergeMetadata(tt.current, tt.new)
161 assert.Equal(t, tt.expected, result)
162 })
163 }
164}

Callers

nothing calls this directly

Calls 1

mergeMetadataFunction · 0.85

Tested by

no test coverage detected