File: 31psgi.t

package info (click to toggle)
libnet-prometheus-perl 0.14-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 304 kB
  • sloc: perl: 1,847; makefile: 8
file content (28 lines) | stat: -rw-r--r-- 615 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/perl

use v5.14;
use warnings;

use Test2::V0;

use List::Util 1.29 qw( pairgrep );

use Net::Prometheus;

my $client = Net::Prometheus->new;

my $app = $client->psgi_app;

ok( defined $app, 'defined $client->psgi_app' );
is( ref $app, "CODE", '$app is CODE' );

ok( my $resp = $app->({ REQUEST_METHOD => "GET" }),
   '$app->() returns a response' );

is( $resp->[0], 200, '$resp->[0] is 200' );
is( ( pairgrep { $a eq "Content-Type" } @{ $resp->[1] } )[1],
   "text/plain; version=0.0.4; charset=utf-8",
   '$resp->[1] contains response headers' );
# TODO: test  join "", @{ $resp->[2] }

done_testing;