aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/xyz/driver/restquery/rest/parsers/SearchFilterParserSuite.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/scala/xyz/driver/restquery/rest/parsers/SearchFilterParserSuite.scala')
-rw-r--r--src/test/scala/xyz/driver/restquery/rest/parsers/SearchFilterParserSuite.scala28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/scala/xyz/driver/restquery/rest/parsers/SearchFilterParserSuite.scala b/src/test/scala/xyz/driver/restquery/rest/parsers/SearchFilterParserSuite.scala
index 9abf372..4abf550 100644
--- a/src/test/scala/xyz/driver/restquery/rest/parsers/SearchFilterParserSuite.scala
+++ b/src/test/scala/xyz/driver/restquery/rest/parsers/SearchFilterParserSuite.scala
@@ -1,5 +1,6 @@
package xyz.driver.restquery.rest.parsers
+import java.time.LocalDate
import java.util.UUID
import fastparse.core.Parsed
@@ -162,6 +163,33 @@ class SearchFilterParserSuite extends FreeSpecLike with Checkers {
}
}
+ "actual startDate - date" - {
+ "should parse the full date as java.time.LocalDate type" in {
+ val filter = SearchFilterParser.parse(Seq("filters" -> "startDate EQ 2018-05-22"))
+ assert(
+ filter === Success(SearchFilterExpr.Atom
+ .Binary(Dimension(None, "start_date"), Eq, LocalDate.of(2018, 5, 22))))
+ }
+ }
+
+ "actual date list" - {
+ "should parse the list of dates as java.time.LocalDate type" in {
+ val filter = SearchFilterParser.parse(Seq("filters" -> ("startDate in 2018-05-19," +
+ "2018-05-20,2018-05-21")))
+ assert(
+ filter === Success(
+ SearchFilterExpr.Atom.NAry(
+ Dimension(None, "start_date"),
+ In,
+ Seq(
+ LocalDate.of(2018, 5, 19),
+ LocalDate.of(2018, 5, 20),
+ LocalDate.of(2018, 5, 21)
+ )
+ )))
+ }
+ }
+
"all operators" - {
"should be parsed with numeric values" in check {
val testQueryGen = queryGen(