Add configurable match-info extension support
Change-Id: I642c7863f1249025c518ee3402536fb07b26e529
diff --git a/t/match_info.t b/t/match_info.t
index edd84b4..1230e7d 100644
--- a/t/match_info.t
+++ b/t/match_info.t
@@ -10,7 +10,13 @@
my $mount_point = '/realapi/';
$ENV{KALAMAR_API} = $mount_point;
-my $t = Test::Mojo->new('Kalamar');
+my $t = Test::Mojo->new('Kalamar' => {
+ Kalamar => {
+ defaults => {
+ match_info_extended => 'max'
+ }
+ }
+});
# Mount fake backend
# Get the fixture path
@@ -24,6 +30,12 @@
# Configure fake backend
$fake_backend->pattern->defaults->{app}->log($t->app->log);
+# The config is exposed on rendered pages
+$t->get_ok('/')
+ ->status_is(200)
+ ->element_exists('body[data-match-info-extended="max"]')
+ ;
+
# Query passed
$t->get_ok('/corpus/WPD15/232/39681/p2133-2134?spans=false&foundry=*&_format=json')
->status_is(200)
@@ -40,6 +52,12 @@
->json_is('/meta/responsePipes','glemm')
;
+# Extended match-info request is accepted and forwarded
+$t->get_ok('/corpus/GOE/AGF/02286/p75682-75683?extended=max&_format=json')
+ ->status_is(200)
+ ->json_is('/textSigle', 'GOE/AGF/02286')
+ ;
+
# TODO:
# It's surprising, that it doesn't return a 404!
$t->get_ok('/corpus/notfound/X/X/p0-1?_format=json')