First working query example with promise based backend
Change-Id: Iee7360d123dc09876d942a32013077d78ea50b91
diff --git a/t/query.t b/t/query.t
index de05a78..75ed9b8 100644
--- a/t/query.t
+++ b/t/query.t
@@ -1,16 +1,37 @@
use Mojo::Base -strict;
use Test::Mojo;
use Test::More;
+use Mojo::File qw/path/;
+
+
+#####################
+# Start Fake server #
+#####################
+my $mount_point = '/api/';
+$ENV{KALAMAR_API} = $mount_point;
my $t = Test::Mojo->new('Kalamar');
+# Mount fake backend
+# Get the fixture path
+my $fixtures_path = path(Mojo::File->new(__FILE__)->dirname, 'fixtures');
+my $fake_backend = $t->app->plugin(
+ Mount => {
+ $mount_point =>
+ $fixtures_path->child('fake_backend.pl')
+ }
+);
+# Configure fake backend
+$fake_backend->pattern->defaults->{app}->log($t->app->log);
+
# Query passed
-$t->get_ok('/q2?q=hui')
+$t->get_ok('/q2?q=baum')
->status_is(200)
->text_is('#error','')
- ->text_is('title', 'KorAP: Find »hui« with Poliqarp')
- ->element_exists('meta[name="DC.title"][content="KorAP: Find »hui« with Poliqarp"]')
+ ->text_is('title', 'KorAP: Find »baum« with Poliqarp')
+ ->element_exists('meta[name="DC.title"][content="KorAP: Find »baum« with Poliqarp"]')
->element_exists('body[itemscope][itemtype="http://schema.org/SearchResultsPage"]')
+ ->text_is('#total-results', 51)
;