Skip to content

Commit

Permalink
✅ Fix UseArb tests
Browse files Browse the repository at this point in the history
Signed-off-by: Leonardo Colman Lopes <[email protected]>
  • Loading branch information
LeoColman committed Jan 11, 2025
1 parent c3459e7 commit dae727a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
10 changes: 9 additions & 1 deletion app/src/test/kotlin/br/com/colman/petals/use/UseArb.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,23 @@ import io.kotest.matchers.sequences.shouldNotContainDuplicates
import io.kotest.matchers.shouldBe
import io.kotest.matchers.string.shouldBeUUID
import io.kotest.property.Arb
import io.kotest.property.arbitrary.Codepoint
import io.kotest.property.arbitrary.arbitrary
import io.kotest.property.arbitrary.az
import io.kotest.property.arbitrary.bigDecimal
import io.kotest.property.arbitrary.localDateTime
import io.kotest.property.arbitrary.string
import io.kotest.property.arbitrary.take
import io.kotest.property.checkAll

val UseArb = arbitrary {
val bigDecimals = Arb.bigDecimal((-100.0).toBigDecimal(), 100.0.toBigDecimal())
Use(Arb.localDateTime().bind(), bigDecimals.bind(), bigDecimals.bind())
Use(
Arb.localDateTime().bind(),
bigDecimals.bind(),
bigDecimals.bind(),
description = Arb.string(codepoints = Codepoint.az()).bind()
)
}

class UseArbitraryTest : FunSpec({
Expand Down
12 changes: 1 addition & 11 deletions app/src/test/kotlin/br/com/colman/petals/use/io/UseCsvArb.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import io.kotest.assertions.throwables.shouldNotThrowAny
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.collections.shouldHaveSize
import io.kotest.matchers.shouldBe
import io.kotest.matchers.string.shouldNotBeBlank
import io.kotest.property.arbitrary.map
import io.kotest.property.checkAll
import java.time.format.DateTimeFormatter
Expand All @@ -17,7 +16,7 @@ class UseCsvArbitraryTest : FunSpec({
test("Generated CSV strings have the correct number of fields") {
checkAll(UseCsvArb) { csvString ->
val fields = csvString.split(",")
fields shouldHaveSize 4
fields shouldHaveSize 5
}
}

Expand All @@ -30,15 +29,6 @@ class UseCsvArbitraryTest : FunSpec({
}
}

test("CSV strings do not contain null or empty fields") {
checkAll(UseCsvArb) { csvString ->
val fields = csvString.split(",")
fields.forEach { field ->
field.shouldNotBeBlank()
}
}
}

test("DateTime is correctly formatted in ISO_LOCAL_DATE_TIME") {
val dateTimePattern = DateTimeFormatter.ISO_LOCAL_DATE_TIME
checkAll(UseCsvArb) { csvString ->
Expand Down

0 comments on commit dae727a

Please sign in to comment.