MetaCPAN-Client

 view release on metacpan or  search on metacpan

t/api/author.t  view on Meta::CPAN

#!perl

use strict;
use warnings;
use Test::More;
use Test::Fatal;
use Ref::Util qw< is_arrayref >;

use lib '.';
use t::lib::Functions;

my $mc = mcpan();
can_ok( $mc, 'author' );

my $author = $mc->author('XSAWYERX');
isa_ok( $author, 'MetaCPAN::Client::Author' );
can_ok( $author, 'pauseid' );
is( $author->pauseid, 'XSAWYERX', 'Correct author' );

my $most_daves;
{
    my $daves = $mc->author( {
        either => [
            { name => 'Dave *'  },
            { name => 'David *' },
        ]
    } );

    isa_ok( $daves, 'MetaCPAN::Client::ResultSet' );
    can_ok( $daves, 'total' );
    ok( $daves->total > 200, 'Lots of Daves' );

    $most_daves = $daves->total;
}

{
    my $daves = $mc->author( {
        either => [
            { name => 'Dave *'  },
            { name => 'David *' },
        ],
        not => [
            { name => 'Dave S*'  },
            { name => 'David S*'  },
        ],
    } );

    isa_ok( $daves, 'MetaCPAN::Client::ResultSet' );
    can_ok( $daves, 'total' );
    ok( $daves->total < $most_daves, 'Definitely less Daves' );
}

{
    my $daves = $mc->author( {
        either => [
            {
                all => [
                    { name  => 'Dave *'     },
                    { email => '*gmail.com' },
                ],
            },

            {
                all => [
                    { name  => 'David *'    },
                    { email => '*gmail.com' },
                ],



( run in 3.195 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )