mirror of https://github.com/usbharu/Hideout.git
style: fix lint
This commit is contained in:
parent
a389036827
commit
4b59802c8d
|
@ -112,18 +112,17 @@ class InboxCommonTest {
|
|||
|
||||
@BeforeAll
|
||||
@JvmStatic
|
||||
fun beforeAll(@Autowired flyway: Flyway) {
|
||||
fun beforeAll() {
|
||||
server = MockServer.feature("classpath:federation/InboxxCommonMockServerTest.feature").http(0).build()
|
||||
_remotePort = server.port.toString()
|
||||
|
||||
flyway.clean()
|
||||
flyway.migrate()
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
@JvmStatic
|
||||
fun afterAll() {
|
||||
fun afterAll(@Autowired flyway: Flyway) {
|
||||
server.stop()
|
||||
flyway.clean()
|
||||
flyway.migrate()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -210,7 +210,6 @@ data class Actor private constructor(
|
|||
fun decrementPostsCount(): Actor = this.copy(postsCount = this.postsCount - 1)
|
||||
|
||||
fun withLastPostAt(lastPostDate: Instant): Actor = this.copy(lastPostDate = lastPostDate)
|
||||
|
||||
override fun toString(): String {
|
||||
return "Actor(" +
|
||||
"id=$id, " +
|
||||
|
@ -232,7 +231,8 @@ data class Actor private constructor(
|
|||
"followersCount=$followersCount, " +
|
||||
"followingCount=$followingCount, " +
|
||||
"postsCount=$postsCount, " +
|
||||
"lastPostDate=$lastPostDate" +
|
||||
"lastPostDate=$lastPostDate, " +
|
||||
"emojis=$emojis" +
|
||||
")"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,12 @@ sealed class Emoji {
|
|||
abstract val domain: String
|
||||
abstract val name: String
|
||||
abstract fun id(): String
|
||||
override fun toString(): String {
|
||||
return "Emoji(" +
|
||||
"domain='$domain', " +
|
||||
"name='$name'" +
|
||||
")"
|
||||
}
|
||||
}
|
||||
|
||||
data class CustomEmoji(
|
||||
|
|
|
@ -18,7 +18,8 @@ class PostQueryMapper(private val postResultRowMapper: ResultRowMapper<Post>) :
|
|||
it.first().let(postResultRowMapper::map)
|
||||
.copy(
|
||||
mediaIds = it.mapNotNull { resultRow -> resultRow.getOrNull(PostsMedia.mediaId) },
|
||||
emojiIds = it.mapNotNull { resultRow -> resultRow.getOrNull(PostsEmojis.emojiId) })
|
||||
emojiIds = it.mapNotNull { resultRow -> resultRow.getOrNull(PostsEmojis.emojiId) }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package dev.usbharu.hideout
|
|||
import com.fasterxml.jackson.module.kotlin.isKotlinClass
|
||||
import com.jparams.verifier.tostring.ToStringVerifier
|
||||
import com.jparams.verifier.tostring.preset.Presets
|
||||
import dev.usbharu.hideout.core.domain.model.emoji.UnicodeEmoji
|
||||
import nl.jqno.equalsverifier.EqualsVerifier
|
||||
import nl.jqno.equalsverifier.Warning
|
||||
import nl.jqno.equalsverifier.internal.reflection.PackageScanner
|
||||
|
@ -95,6 +96,7 @@ class EqualsAndToStringTest {
|
|||
.filter {
|
||||
it.superclass == Any::class.java || it.superclass?.packageName?.startsWith("dev.usbharu") ?: true
|
||||
}
|
||||
.filterNot { it == UnicodeEmoji::class.java }
|
||||
.map {
|
||||
|
||||
dynamicTest(it.name) {
|
||||
|
|
|
@ -3,6 +3,7 @@ package dev.usbharu.hideout.activitypub.service.activity.like
|
|||
|
||||
import dev.usbharu.hideout.application.service.id.TwitterSnowflakeIdGenerateService
|
||||
import dev.usbharu.hideout.core.domain.model.actor.ActorRepository
|
||||
import dev.usbharu.hideout.core.domain.model.emoji.UnicodeEmoji
|
||||
import dev.usbharu.hideout.core.domain.model.post.PostRepository
|
||||
import dev.usbharu.hideout.core.domain.model.reaction.Reaction
|
||||
import dev.usbharu.hideout.core.external.job.DeliverReactionJob
|
||||
|
@ -48,7 +49,7 @@ class APReactionServiceImplTest {
|
|||
apReactionServiceImpl.reaction(
|
||||
Reaction(
|
||||
id = TwitterSnowflakeIdGenerateService.generateId(),
|
||||
emojiId = 0,
|
||||
emoji = UnicodeEmoji("❤"),
|
||||
postId = post.id,
|
||||
actorId = user.id
|
||||
)
|
||||
|
@ -88,7 +89,7 @@ class APReactionServiceImplTest {
|
|||
apReactionServiceImpl.removeReaction(
|
||||
Reaction(
|
||||
id = TwitterSnowflakeIdGenerateService.generateId(),
|
||||
emojiId = 0,
|
||||
emoji = UnicodeEmoji("❤"),
|
||||
postId = post.id,
|
||||
actorId = user.id
|
||||
)
|
||||
|
|
|
@ -3,6 +3,7 @@ package dev.usbharu.hideout.core.service.reaction
|
|||
|
||||
import dev.usbharu.hideout.activitypub.service.activity.like.APReactionService
|
||||
import dev.usbharu.hideout.application.service.id.TwitterSnowflakeIdGenerateService
|
||||
import dev.usbharu.hideout.core.domain.model.emoji.UnicodeEmoji
|
||||
import dev.usbharu.hideout.core.domain.model.reaction.Reaction
|
||||
import dev.usbharu.hideout.core.domain.model.reaction.ReactionRepository
|
||||
import kotlinx.coroutines.test.runTest
|
||||
|
@ -40,7 +41,7 @@ class ReactionServiceImplTest {
|
|||
|
||||
reactionServiceImpl.receiveReaction("❤", "example.com", post.actorId, post.id)
|
||||
|
||||
verify(reactionRepository, times(1)).save(eq(Reaction(generateId, 0, post.id, post.actorId)))
|
||||
verify(reactionRepository, times(1)).save(eq(Reaction(generateId, UnicodeEmoji("❤"), post.id, post.actorId)))
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -56,7 +57,7 @@ class ReactionServiceImplTest {
|
|||
eq(
|
||||
Reaction(
|
||||
id = generateId,
|
||||
emojiId = 0,
|
||||
emoji = UnicodeEmoji("❤"),
|
||||
postId = post.id,
|
||||
actorId = post.actorId
|
||||
)
|
||||
|
@ -72,7 +73,7 @@ class ReactionServiceImplTest {
|
|||
|
||||
reactionServiceImpl.receiveReaction("❤", "example.com", post.actorId, post.id)
|
||||
|
||||
verify(reactionRepository, times(1)).save(eq(Reaction(generateId, 0, post.id, post.actorId)))
|
||||
verify(reactionRepository, times(1)).save(eq(Reaction(generateId, UnicodeEmoji("❤"), post.id, post.actorId)))
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -98,8 +99,8 @@ class ReactionServiceImplTest {
|
|||
|
||||
reactionServiceImpl.sendReaction("❤", post.actorId, post.id)
|
||||
|
||||
verify(reactionRepository, times(1)).save(eq(Reaction(generateId, 0, post.id, post.actorId)))
|
||||
verify(apReactionService, times(1)).reaction(eq(Reaction(generateId, 0, post.id, post.actorId)))
|
||||
verify(reactionRepository, times(1)).save(eq(Reaction(generateId, UnicodeEmoji("❤"), post.id, post.actorId)))
|
||||
verify(apReactionService, times(1)).reaction(eq(Reaction(generateId, UnicodeEmoji("❤"), post.id, post.actorId)))
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -107,7 +108,7 @@ class ReactionServiceImplTest {
|
|||
val post = PostBuilder.of()
|
||||
val id = TwitterSnowflakeIdGenerateService.generateId()
|
||||
whenever(reactionRepository.findByPostIdAndActorIdAndEmojiId(eq(post.id), eq(post.actorId), eq(0))).doReturn(
|
||||
Reaction(id, 0, post.id, post.actorId)
|
||||
Reaction(id, UnicodeEmoji("❤"), post.id, post.actorId)
|
||||
)
|
||||
val generateId = TwitterSnowflakeIdGenerateService.generateId()
|
||||
whenever(reactionRepository.generateId()).doReturn(generateId)
|
||||
|
@ -115,22 +116,22 @@ class ReactionServiceImplTest {
|
|||
reactionServiceImpl.sendReaction("❤", post.actorId, post.id)
|
||||
|
||||
|
||||
verify(reactionRepository, times(1)).delete(eq(Reaction(id, 0, post.id, post.actorId)))
|
||||
verify(reactionRepository, times(1)).save(eq(Reaction(generateId, 0, post.id, post.actorId)))
|
||||
verify(apReactionService, times(1)).removeReaction(eq(Reaction(id, 0, post.id, post.actorId)))
|
||||
verify(apReactionService, times(1)).reaction(eq(Reaction(generateId, 0, post.id, post.actorId)))
|
||||
verify(reactionRepository, times(1)).delete(eq(Reaction(id, UnicodeEmoji("❤"), post.id, post.actorId)))
|
||||
verify(reactionRepository, times(1)).save(eq(Reaction(generateId, UnicodeEmoji("❤"), post.id, post.actorId)))
|
||||
verify(apReactionService, times(1)).removeReaction(eq(Reaction(id, UnicodeEmoji("❤"), post.id, post.actorId)))
|
||||
verify(apReactionService, times(1)).reaction(eq(Reaction(generateId, UnicodeEmoji("❤"), post.id, post.actorId)))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `removeReaction リアクションが存在する場合削除して配送`() = runTest {
|
||||
val post = PostBuilder.of()
|
||||
whenever(reactionRepository.findByPostIdAndActorIdAndEmojiId(eq(post.id), eq(post.actorId), eq(0))).doReturn(
|
||||
Reaction(0, 0, post.id, post.actorId)
|
||||
Reaction(0, UnicodeEmoji("❤"), post.id, post.actorId)
|
||||
)
|
||||
|
||||
reactionServiceImpl.removeReaction(post.actorId, post.id)
|
||||
|
||||
verify(reactionRepository, times(1)).delete(eq(Reaction(0, 0, post.id, post.actorId)))
|
||||
verify(apReactionService, times(1)).removeReaction(eq(Reaction(0, 0, post.id, post.actorId)))
|
||||
verify(reactionRepository, times(1)).delete(eq(Reaction(0, UnicodeEmoji("❤"), post.id, post.actorId)))
|
||||
verify(apReactionService, times(1)).removeReaction(eq(Reaction(0, UnicodeEmoji("❤"), post.id, post.actorId)))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue