]> Dogcows Code - chaz/p5-HTTP-AnyUA/blobdiff - t/40-middleware-runtime.t
fix transform in void context, Middleware::Runtime
[chaz/p5-HTTP-AnyUA] / t / 40-middleware-runtime.t
index 5597fda9ed1f4ec46425dcd2f223c905d8d9780d..594555e7180f2050991735a8a2f821f1e9f02b1c 100644 (file)
@@ -5,8 +5,9 @@ use strict;
 
 use lib 't/lib';
 
+use Future;
 use HTTP::AnyUA;
-use Test::More tests => 1;
+use Test::More tests => 2;
 
 HTTP::AnyUA->register_backend(Mock => '+MockBackend');
 
@@ -16,8 +17,23 @@ my $backend = $any_ua->backend;
 $any_ua->apply_middleware('Runtime');
 
 my $url = 'http://acme.tld/';
-
+my $mock_response = {
+    success => 1,
+    status  => 200,
+    reason  => 'OK',
+    content => 'whatever',
+};
+
+$backend->response({%$mock_response});
 my $resp = $any_ua->get($url);
 note explain $resp;
 isnt $resp->{runtime}, undef, 'runtime is defined';
 
+$backend->response(Future->done({%$mock_response}));
+$resp = $any_ua->get($url);
+$resp->on_done(sub {
+    my $resp = shift;
+    note explain $resp;
+    isnt $resp->{runtime}, undef, 'runtime is defined when response is future';
+});
+
This page took 0.02085 seconds and 4 git commands to generate.