-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Include updated images in commit message (#49)
resolve: #49
- Loading branch information
Showing
6 changed files
with
107 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package task | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/bluebrown/kobold/krm" | ||
) | ||
|
||
func TestGetCommitMessage(t *testing.T) { | ||
type args struct { | ||
changes []krm.Change | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want string | ||
wantErr bool | ||
}{ | ||
{ | ||
name: "single image", | ||
args: args{ | ||
changes: []krm.Change{ | ||
{ | ||
Description: "busybox:1.0.0 -> busybox:1.0.1", | ||
Repo: "busybox", | ||
}, | ||
}, | ||
}, | ||
want: "chore(kobold): Update busybox", | ||
wantErr: false, | ||
}, | ||
{ | ||
name: "multiple images", | ||
args: args{ | ||
changes: []krm.Change{ | ||
{ | ||
Description: "busybox:1.0.0 -> busybox:1.0.1", | ||
Repo: "busybox", | ||
}, | ||
{ | ||
Description: "somerepo:2.0.0 -> somerepo:2.0.1", | ||
Repo: "somerepo", | ||
}, | ||
}, | ||
}, | ||
want: "chore(kobold): Update busybox somerepo", | ||
wantErr: false, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
got, err := GetCommitMessage(tt.args.changes) | ||
if (err != nil) != tt.wantErr { | ||
t.Errorf("GetCommitMessage() error = %v, wantErr %v", err, tt.wantErr) | ||
return | ||
} | ||
if got != tt.want { | ||
t.Errorf("GetCommitMessage() got = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters