-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Now the funSpec test are made in getFormattedValue cheking if it return correctly
- Loading branch information
Showing
3 changed files
with
36 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 0 additions & 29 deletions
29
.../kotlin/br/com/colman/petals/statistics/graph/data/DistributionPerDaySinceFirstUseTest.kt
This file was deleted.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
...test/kotlin/br/com/colman/petals/statistics/graph/formatter/DaysSinceFirstUseFormatter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package br.com.colman.petals.statistics.graph.formatter | ||
|
||
import io.kotest.core.spec.style.FunSpec | ||
import io.kotest.data.Row2 | ||
import io.kotest.data.forAll | ||
import io.kotest.matchers.shouldBe | ||
import java.time.LocalDateTime.now | ||
import java.time.format.DateTimeFormatter | ||
|
||
class DaysSinceFirstUseFormatter: FunSpec({ | ||
|
||
test("getFormattedValue returns correctly formatted days since first use (yyyy-MM-dd)"){ | ||
val dateFormat = "yyyy-MM-dd" | ||
val formatter = DateTimeFormatter.ofPattern(dateFormat) | ||
forAll( | ||
Row2(0f, now().minusDays(3).format(formatter).toString()), | ||
Row2(1f, now().minusDays(2).format(formatter).toString()), | ||
Row2(2f, now().minusDays(1).format(formatter).toString()), | ||
Row2(3f, now().format(formatter).toString()) | ||
){ value, expectedDay -> | ||
val actual = DaysSinceFirstUseFormatter.getFormattedValue((value), null) | ||
actual shouldBe expectedDay | ||
} | ||
} | ||
}) |