From e38b87516f3af552c762f7c06f5d6ff909ac6354 Mon Sep 17 00:00:00 2001 From: RedCocoon Date: Thu, 7 Nov 2024 23:47:07 +0800 Subject: [PATCH] Update consistency.go --- models/unittest/consistency.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/models/unittest/consistency.go b/models/unittest/consistency.go index 71839001be0..e750b0b0e98 100644 --- a/models/unittest/consistency.go +++ b/models/unittest/consistency.go @@ -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["repository"] = checkForRepoConsistency consistencyCheckMap["issue"] = checkForIssueConsistency @@ -187,4 +194,5 @@ func init() { consistencyCheckMap["label"] = checkForLabelConsistency consistencyCheckMap["team"] = checkForTeamConsistency consistencyCheckMap["action"] = checkForActionConsistency + consistencyCheckMap["conversation"] = checkForConversationConsistency }