Add query parameter validation
Change-Id: Ib0fa76faf0c70bb8373bf723f238c9e88b5b890a
diff --git a/t/match_info.t b/t/match_info.t
index 7403d52..5d23887 100644
--- a/t/match_info.t
+++ b/t/match_info.t
@@ -98,6 +98,11 @@
->header_is('X-Kalamar-Cache', 'true')
;
+# Check for validation error
+$t->get_ok('/corpus/WPD15/232/39681/p2133-2134?spans=no')
+ ->status_is(400)
+ ->json_is('/notifications/0/1', 'Parameter "spans" invalid')
+ ;
done_testing;
__END__
diff --git a/t/query.t b/t/query.t
index 933276f..59d8fc9 100644
--- a/t/query.t
+++ b/t/query.t
@@ -157,7 +157,22 @@
->content_like(qr!\"cutOff":true!)
;
-
+# Query with failing parameters
+$t->get_ok('/?q=fantastisch&ql=Fabelsprache')
+ ->status_is(400)
+ ->text_is('noscript div.notify-error', 'Parameter "ql" invalid')
+ ->element_count_is('noscript div.notify-error', 1)
+ ;
+$t->get_ok('/?q=fantastisch&cutoff=no')
+ ->status_is(400)
+ ->text_is('noscript div.notify-error', 'Parameter "cutoff" invalid')
+ ->element_count_is('noscript div.notify-error', 1)
+ ;
+$t->get_ok('/?q=fantastisch&p=hui&o=hui&count=-8')
+ ->status_is(400)
+ ->text_like('noscript div.notify-error', qr!Parameter ".+?" invalid!)
+ ->element_count_is('noscript div.notify-error', 3)
+ ;
done_testing;