From dae727a708c35b79c77b819ef4c38e130be38350 Mon Sep 17 00:00:00 2001 From: Leonardo Colman Lopes Date: Sat, 11 Jan 2025 19:27:26 -0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20Fix=20UseArb=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Leonardo Colman Lopes --- .../test/kotlin/br/com/colman/petals/use/UseArb.kt | 10 +++++++++- .../kotlin/br/com/colman/petals/use/io/UseCsvArb.kt | 12 +----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/app/src/test/kotlin/br/com/colman/petals/use/UseArb.kt b/app/src/test/kotlin/br/com/colman/petals/use/UseArb.kt index fb1a0bb1..f9739e01 100644 --- a/app/src/test/kotlin/br/com/colman/petals/use/UseArb.kt +++ b/app/src/test/kotlin/br/com/colman/petals/use/UseArb.kt @@ -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({ diff --git a/app/src/test/kotlin/br/com/colman/petals/use/io/UseCsvArb.kt b/app/src/test/kotlin/br/com/colman/petals/use/io/UseCsvArb.kt index a91f5803..75446d5c 100644 --- a/app/src/test/kotlin/br/com/colman/petals/use/io/UseCsvArb.kt +++ b/app/src/test/kotlin/br/com/colman/petals/use/io/UseCsvArb.kt @@ -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 @@ -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 } } @@ -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 ->