Skip to content

Commit

Permalink
Debug failing CI test
Browse files Browse the repository at this point in the history
  • Loading branch information
violine1101 committed Apr 19, 2024
1 parent a5fd971 commit b3c54e0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import io.github.mojira.arisa.domain.Issue
import io.github.mojira.arisa.domain.Project
import io.github.mojira.arisa.domain.User
import io.github.mojira.arisa.infrastructure.HelperMessageService
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import java.time.Instant
import java.time.temporal.ChronoUnit

Expand Down Expand Up @@ -80,17 +82,28 @@ class ReopenAwaitingModule(
comment.visibilityValue == "staff" &&
(comment.body?.contains(keepARTag) ?: false)

private fun isKeepARMessage(comment: Comment, project: Project) = comment.author.name == "arisabot" &&
(
comment.body?.contains(
HelperMessageService.getMessageWithBotSignature(
project.key,
message,
null,
"en"
)
) ?: false
)
private val log: Logger = LoggerFactory.getLogger("ReopenAwaitingModule")

private fun isKeepARMessage(comment: Comment, project: Project): Boolean {
log.debug("isKeepAR message: ${comment.body}")

if (comment.author.name != "arisabot") {
log.debug("author: ${comment.author.name}; contains message: false")
return false
}

val keepARMessage = HelperMessageService.getMessageWithBotSignature(
project.key,
message,
null,
"en"
)
log.debug("keep AR message: $keepARMessage")

val result = comment.body?.contains(keepARMessage) ?: false
log.debug("contains message: $result")
return result
}

private fun getValidComments(
comments: List<Comment>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import io.github.mojira.arisa.utils.mockChangeLogItem
import io.github.mojira.arisa.utils.mockComment
import io.github.mojira.arisa.utils.mockIssue
import io.github.mojira.arisa.utils.mockUser
import io.github.mojira.arisa.utils.mockProject
import io.kotest.assertions.arrow.either.shouldBeLeft
import io.kotest.assertions.arrow.either.shouldBeRight
import io.kotest.core.spec.style.StringSpec
Expand Down Expand Up @@ -855,7 +856,8 @@ class ReopenAwaitingModuleTest : StringSpec({
comments = listOf(tagComment, arisaComment, normalComment),
changeLog = listOf(AWAITING_RESOLVE),
reopen = { hasReopened = true; Unit.right() },
addComment = { hasCommented = true; Unit.right() }
addComment = { hasCommented = true; Unit.right() },
project = mockProject(key = "MC")
)

val result = MODULE(issue, TEN_SECONDS_AGO)
Expand Down

0 comments on commit b3c54e0

Please sign in to comment.