MCPcopy Create free account
hub / github.com/driangle/taskmd / TestBuildMixedCommitMessage

Function TestBuildMixedCommitMessage

apps/cli/internal/cli/commit_msg_test.go:1091–1145  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1089}
1090
1091func TestBuildMixedCommitMessage(t *testing.T) {
1092 tests := []struct {
1093 name string
1094 changes TaskChanges
1095 short bool
1096 body bool
1097 want string
1098 }{
1099 {
1100 name: "completed and added",
1101 changes: TaskChanges{
1102 Completed: []*model.Task{{ID: "042"}},
1103 Added: []*model.Task{{ID: "045"}},
1104 },
1105 want: "chore: complete task 042; add task 045\n",
1106 },
1107 {
1108 name: "all five categories",
1109 changes: TaskChanges{
1110 Completed: []*model.Task{{ID: "001"}},
1111 Added: []*model.Task{{ID: "002"}},
1112 Started: []*model.Task{{ID: "003"}},
1113 Blocked: []*model.Task{{ID: "004"}},
1114 Cancelled: []*model.Task{{ID: "005"}},
1115 },
1116 want: "chore: complete task 001; add task 002; start task 003; block task 004; cancel task 005\n",
1117 },
1118 {
1119 name: "multiple per category",
1120 changes: TaskChanges{
1121 Completed: []*model.Task{{ID: "001"}, {ID: "002"}},
1122 Added: []*model.Task{{ID: "003"}},
1123 },
1124 want: "chore: complete tasks 001, 002; add task 003\n",
1125 },
1126 {
1127 name: "short flag",
1128 changes: TaskChanges{
1129 Completed: []*model.Task{{ID: "001"}},
1130 Added: []*model.Task{{ID: "002"}},
1131 },
1132 short: true,
1133 want: "chore: complete task 001; add task 002\n",
1134 },
1135 }
1136
1137 for _, tt := range tests {
1138 t.Run(tt.name, func(t *testing.T) {
1139 got := buildMixedCommitMessage(tt.changes, "chore", tt.body, tt.short)
1140 if got != tt.want {
1141 t.Errorf("buildMixedCommitMessage() = %q, want %q", got, tt.want)
1142 }
1143 })
1144 }
1145}
1146
1147func TestChangeSegment(t *testing.T) {
1148 tests := []struct {

Callers

nothing calls this directly

Calls 1

buildMixedCommitMessageFunction · 0.85

Tested by

no test coverage detected