(Feat): Initial Commit
This commit is contained in:
41
internal/util/map_test.go
Normal file
41
internal/util/map_test.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package util_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"allaboutapps.dev/aw/go-starter/internal/util"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestMergeStringMap(t *testing.T) {
|
||||
baseMap := map[string]string{
|
||||
"A": "a",
|
||||
"B": "b",
|
||||
"C": "c",
|
||||
}
|
||||
|
||||
toMerge := map[string]string{
|
||||
"C": "1",
|
||||
"D": "2",
|
||||
}
|
||||
|
||||
expected := map[string]string{
|
||||
"A": "a",
|
||||
"B": "b",
|
||||
"C": "c",
|
||||
"D": "2",
|
||||
}
|
||||
|
||||
res := util.MergeStringMap(baseMap, toMerge)
|
||||
assert.Equal(t, expected, res)
|
||||
|
||||
expected = map[string]string{
|
||||
"C": "1",
|
||||
"D": "2",
|
||||
"A": "a",
|
||||
"B": "b",
|
||||
}
|
||||
|
||||
res = util.MergeStringMap(toMerge, baseMap)
|
||||
assert.Equal(t, expected, res)
|
||||
}
|
||||
Reference in New Issue
Block a user