update ktlint rules

This commit is contained in:
2025-03-14 03:23:16 +01:00
parent 492981bed0
commit b4234a9b37
97 changed files with 2392 additions and 2359 deletions

View File

@@ -14,42 +14,42 @@ import kotlin.test.assertIs
@Serializable
data class CommandTest(
override val id: CommandId,
override val id: CommandId,
) : Command
class FrameChannelConverterTest :
FunSpec({
FunSpec({
test("toObjectChannel") {
val uuid = "d737c631-76af-406e-bc29-f3e5b97226a5"
val id = CommandId(UUID.fromString(uuid))
val jsonCommand = """{"id":"$uuid"}"""
test("toObjectChannel") {
val uuid = "d737c631-76af-406e-bc29-f3e5b97226a5"
val id = CommandId(UUID.fromString(uuid))
val jsonCommand = """{"id":"$uuid"}"""
val channel = Channel<Frame>()
val channel = Channel<Frame>()
launch {
val commandChannel = toObjectChannel<CommandTest>(channel)
commandChannel.receive().id shouldBeEqual id
channel.close()
}
launch {
val commandChannel = toObjectChannel<CommandTest>(channel)
commandChannel.receive().id shouldBeEqual id
channel.close()
}
channel.send(Frame.Text(jsonCommand))
}
channel.send(Frame.Text(jsonCommand))
}
test("fromFrameChannel") {
val uuid = "d737c631-76af-406e-bc29-f3e5b97226a5"
val id = CommandId(UUID.fromString(uuid))
val command = CommandTest(id)
val jsonCommand = """{"id":"$uuid"}"""
test("fromFrameChannel") {
val uuid = "d737c631-76af-406e-bc29-f3e5b97226a5"
val id = CommandId(UUID.fromString(uuid))
val command = CommandTest(id)
val jsonCommand = """{"id":"$uuid"}"""
val channel = Channel<Frame>()
val channel = Channel<Frame>()
launch {
val commandChannel = fromFrameChannel<CommandTest>(channel)
commandChannel.send(command)
commandChannel.close()
}
launch {
val commandChannel = fromFrameChannel<CommandTest>(channel)
commandChannel.send(command)
commandChannel.close()
}
assertIs<Frame.Text>(channel.receive()).readText() shouldBeEqual jsonCommand
}
})
assertIs<Frame.Text>(channel.receive()).readText() shouldBeEqual jsonCommand
}
})

View File

@@ -8,26 +8,26 @@ import kotlinx.serialization.Serializable
@Serializable
class CommandTest(
override val id: CommandId,
override val id: CommandId,
) : Command
class CommandStreamChannelTest :
FunSpec({
FunSpec({
test("send and receive") {
val command = CommandTest(CommandId())
test("send and receive") {
val command = CommandTest(CommandId())
val channel = Channel<CommandTest>()
val stream =
CommandStreamChannel(channel)
val channel = Channel<CommandTest>()
val stream =
CommandStreamChannel(channel)
val spyCall: () -> Unit = mockk(relaxed = true)
val spyCall: () -> Unit = mockk(relaxed = true)
stream.blockAndProcess {
println("In action ${it.id}")
spyCall()
}
channel.send(command)
verify(exactly = 1) { spyCall() }
}
})
stream.blockAndProcess {
println("In action ${it.id}")
spyCall()
}
channel.send(command)
verify(exactly = 1) { spyCall() }
}
})

View File

@@ -3,8 +3,8 @@ package eventDemo.libs.event
import io.kotest.core.spec.style.FunSpec
class EventBusInMemoryTest :
FunSpec({
FunSpec({
xtest("publish should call the subscribed functions") { }
xtest("publish should call the subscribed functions on the priority order") { }
})
xtest("publish should call the subscribed functions") { }
xtest("publish should call the subscribed functions on the priority order") { }
})

View File

@@ -3,14 +3,14 @@ package eventDemo.libs.event
import io.kotest.core.spec.style.FunSpec
class EventStreamInMemoryTest :
FunSpec({
FunSpec({
xtest("publish should be concurrently secure") { }
xtest("publish should be concurrently secure") { }
xtest("readLast should only return the event of aggregate") { }
xtest("readLast should return the last event of the aggregate") { }
xtest("readLast should only return the event of aggregate") { }
xtest("readLast should return the last event of the aggregate") { }
xtest("readLastOf should return the last event of the aggregate of the type") { }
xtest("readLastOf should return the last event of the aggregate of the type") { }
xtest("readAll should only return the event of aggregate") { }
})
xtest("readAll should only return the event of aggregate") { }
})

View File

@@ -10,43 +10,43 @@ import java.util.UUID
@JvmInline
private value class IdTest(
override val id: UUID = UUID.randomUUID(),
override val id: UUID = UUID.randomUUID(),
) : AggregateId
@OptIn(DelicateCoroutinesApi::class)
class VersionBuilderLocalTest :
FunSpec({
FunSpec({
test("buildNextVersion") {
VersionBuilderLocal().run {
val id = IdTest()
buildNextVersion(id) shouldBeEqual 1
buildNextVersion(id) shouldBeEqual 2
buildNextVersion(IdTest()) shouldBeEqual 1
buildNextVersion(id) shouldBeEqual 3
test("buildNextVersion") {
VersionBuilderLocal().run {
val id = IdTest()
buildNextVersion(id) shouldBeEqual 1
buildNextVersion(id) shouldBeEqual 2
buildNextVersion(IdTest()) shouldBeEqual 1
buildNextVersion(id) shouldBeEqual 3
}
}
test("buildNextVersion concurrently") {
val versionBuilder = VersionBuilderLocal()
val id = IdTest()
(1..20)
.map {
GlobalScope.launch {
(1..1000).map {
versionBuilder.buildNextVersion(id)
}
}
}
}.joinAll()
versionBuilder.getLastVersion(id) shouldBeEqual 20 * 1000
}
test("buildNextVersion concurrently") {
val versionBuilder = VersionBuilderLocal()
val id = IdTest()
(1..20)
.map {
GlobalScope.launch {
(1..1000).map {
versionBuilder.buildNextVersion(id)
}
}
}.joinAll()
versionBuilder.getLastVersion(id) shouldBeEqual 20 * 1000
}
test("getLastVersion") {
VersionBuilderLocal().run {
val id = IdTest()
getLastVersion(id) shouldBeEqual 0
getLastVersion(id) shouldBeEqual 0
getLastVersion(id) shouldBeEqual 0
}
}
})
test("getLastVersion") {
VersionBuilderLocal().run {
val id = IdTest()
getLastVersion(id) shouldBeEqual 0
getLastVersion(id) shouldBeEqual 0
getLastVersion(id) shouldBeEqual 0
}
}
})