Update consistency.go

This commit is contained in:
RedCocoon 2024-11-07 23:47:07 +08:00
parent 13ddbd115a
commit e38b87516f

View File

@ -179,6 +179,13 @@ func init() {
} }
} }
checkForConversationConsistency := func(t assert.TestingT, bean any) {
conversation := reflectionWrap(bean)
typeComment := modelsCommentTypeComment
actual := GetCountByCond(t, "comment", builder.Eq{"`type`": typeComment, "conversation_id": conversation.int("ID")})
assert.EqualValues(t, conversation.int("NumComments"), actual, "Unexpected number of comments for issue id: %d", conversation.int("ID"))
}
consistencyCheckMap["user"] = checkForUserConsistency consistencyCheckMap["user"] = checkForUserConsistency
consistencyCheckMap["repository"] = checkForRepoConsistency consistencyCheckMap["repository"] = checkForRepoConsistency
consistencyCheckMap["issue"] = checkForIssueConsistency consistencyCheckMap["issue"] = checkForIssueConsistency
@ -187,4 +194,5 @@ func init() {
consistencyCheckMap["label"] = checkForLabelConsistency consistencyCheckMap["label"] = checkForLabelConsistency
consistencyCheckMap["team"] = checkForTeamConsistency consistencyCheckMap["team"] = checkForTeamConsistency
consistencyCheckMap["action"] = checkForActionConsistency consistencyCheckMap["action"] = checkForActionConsistency
consistencyCheckMap["conversation"] = checkForConversationConsistency
} }