Skip to content

Commit e38b875

Browse files
committed
Update consistency.go
1 parent 13ddbd1 commit e38b875

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

models/unittest/consistency.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,13 @@ func init() {
179179
}
180180
}
181181

182+
checkForConversationConsistency := func(t assert.TestingT, bean any) {
183+
conversation := reflectionWrap(bean)
184+
typeComment := modelsCommentTypeComment
185+
actual := GetCountByCond(t, "comment", builder.Eq{"`type`": typeComment, "conversation_id": conversation.int("ID")})
186+
assert.EqualValues(t, conversation.int("NumComments"), actual, "Unexpected number of comments for issue id: %d", conversation.int("ID"))
187+
}
188+
182189
consistencyCheckMap["user"] = checkForUserConsistency
183190
consistencyCheckMap["repository"] = checkForRepoConsistency
184191
consistencyCheckMap["issue"] = checkForIssueConsistency
@@ -187,4 +194,5 @@ func init() {
187194
consistencyCheckMap["label"] = checkForLabelConsistency
188195
consistencyCheckMap["team"] = checkForTeamConsistency
189196
consistencyCheckMap["action"] = checkForActionConsistency
197+
consistencyCheckMap["conversation"] = checkForConversationConsistency
190198
}

0 commit comments

Comments
 (0)