The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

TESTING

Testing a Minima web application is a straightforward task thanks to Plack::Test and HTTP::Request::Common. A basic setup looks like this:

use HTTP::Request::Common;
use Minima::Setup;
use Plack::Test;

my $app  = \&Minima::Setup::init;
my $test = Plack::Test->create($app);

If you'd prefer to simplify it further, Minima::Setup provides a test method:

use HTTP::Request::Common;
use Minima::Setup;
use Test2::V0;

my $test = Minima::Setup::test;

my $res = $test->request(GET '/');

is( $res->code, 200, 'returned 200 for root' );
like( $res->content, qr/<html>/, 'outputs HTML' );

SEE ALSO

Minima, Minima::Project, Minima::App.

AUTHOR

Cesar Tessarin, <cesar@tessarin.com.br>.

Written in September 2024.