aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/xyz/driver/pdsuidomain/DocumentSuite.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/scala/xyz/driver/pdsuidomain/DocumentSuite.scala')
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/DocumentSuite.scala25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/test/scala/xyz/driver/pdsuidomain/DocumentSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/DocumentSuite.scala
index da8d6f3..78edc10 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/DocumentSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/DocumentSuite.scala
@@ -1,6 +1,6 @@
package xyz.driver.pdsuidomain
-import java.time.LocalDateTime
+import java.time.{LocalDate, LocalDateTime}
import java.time.temporal.ChronoUnit
import xyz.driver.pdsuicommon.BaseSuite
@@ -13,22 +13,21 @@ class DocumentSuite extends BaseSuite {
"can't submit invalid data" - {
val base = sampleDocument
- val now = LocalDateTime.now()
- val past1 = now.minus(2, ChronoUnit.DAYS)
- val past2 = past1.plus(1, ChronoUnit.DAYS)
+ val now = LocalDate.now()
+ val past1 = now.minus(2, ChronoUnit.DAYS)
+ val past2 = past1.plus(1, ChronoUnit.DAYS)
val future1 = now.plus(1, ChronoUnit.DAYS)
val future2 = future1.plus(1, ChronoUnit.DAYS)
Seq(
- "startDate should be non-empty" -> base.copy(startDate = None),
- "startDate should be greater, than endDate" -> base.copy(startDate = Some(past2), endDate = Some(past1)),
+ "startDate should be non-empty" -> base.copy(startDate = None),
+ "startDate should be greater, than endDate" -> base.copy(startDate = Some(past2), endDate = Some(past1)),
"startDate and endDate should be in the past" -> base.copy(startDate = Some(future1), endDate = Some(future2))
- ).foreach {
- case (title, orig) =>
- s"$title" in {
- val r = Document.validator(orig)
- assert(r.isLeft, s"should fail, but: ${r.right}")
- }
+ ).foreach { case (title, orig) =>
+ s"$title" in {
+ val r = Document.validator(orig)
+ assert(r.isLeft, s"should fail, but: ${r.right}")
+ }
}
}
}
@@ -47,7 +46,7 @@ class DocumentSuite extends BaseSuite {
typeId = Some(LongId(123)),
providerName = Some("etst"),
providerTypeId = Some(LongId(123)),
- startDate = Some(lastUpdate.minusDays(2)),
+ startDate = Some(lastUpdate.toLocalDate.minusDays(2)),
endDate = None,
lastUpdate = lastUpdate,
meta = Some(TextJson(Document.Meta(None, 1.1, 2.2)))