From 3f09d275918cd95803f386dc86338a1cc6e1d7b1 Mon Sep 17 00:00:00 2001 From: Beatriz Vieira Date: Sat, 21 Jan 2023 23:30:29 -0300 Subject: [PATCH] test: unit test for overwrite tag config issue: #84 --- cmd/git-sv/config_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/git-sv/config_test.go b/cmd/git-sv/config_test.go index c7bd3dc..79d56a9 100644 --- a/cmd/git-sv/config_test.go +++ b/cmd/git-sv/config_test.go @@ -10,6 +10,8 @@ import ( func Test_merge(t *testing.T) { boolFalse := false boolTrue := true + emptyStr := "" + nonEmptyStr := "something" tests := []struct { name string @@ -34,6 +36,8 @@ func Test_merge(t *testing.T) { {"merge empty maps", Config{CommitMessage: sv.CommitMessageConfig{Footer: map[string]sv.CommitMessageFooterConfig{"issue": {Key: "jira"}}}}, Config{CommitMessage: sv.CommitMessageConfig{Footer: map[string]sv.CommitMessageFooterConfig{}}}, Config{CommitMessage: sv.CommitMessageConfig{Footer: map[string]sv.CommitMessageFooterConfig{"issue": {Key: "jira"}}}}, false}, {"overwrite release notes header", Config{ReleaseNotes: sv.ReleaseNotesConfig{Headers: map[string]string{"a": "aa"}}}, Config{ReleaseNotes: sv.ReleaseNotesConfig{Headers: map[string]string{"b": "bb"}}}, Config{ReleaseNotes: sv.ReleaseNotesConfig{Headers: map[string]string{"b": "bb"}}}, false}, + + {"overwrite tag config", Config{Version: "a", Tag: sv.TagConfig{Pattern: &nonEmptyStr, Filter: &nonEmptyStr}}, Config{Version: "", Tag: sv.TagConfig{Pattern: &emptyStr, Filter: &emptyStr}}, Config{Version: "a", Tag: sv.TagConfig{Pattern: &emptyStr, Filter: &emptyStr}}, false}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {