Astro-DSS-JPEG

 view release on metacpan or  search on metacpan

t/simple.t  view on Meta::CPAN

use Test2::V0;
use Test2::Mock;
use Test::MockObject;

use Astro::DSS::JPEG;
use LWP::UserAgent;

use utf8;

# The test won't actually fetch data over the internet. This is to ensure it will
# not fail even if the DSS & SIMBAD endpoints change - you can still use the module
# by passing the updated urls to the constructor.

my $dss = Astro::DSS::JPEG->new(
    dss_url    => 'xxx',
    simbad_url => 'xxx',
    ua         => LWP::UserAgent->new()
);

ok($dss, 'Object OK');

subtest '_convert_coordinates' => sub {
    my @test = (
        {
            ra  => '06 30 3.6',
            dec => '+15 45 36',
        },
        {
            ra  => '6h30m3.6s',
            dec => q{ +15d 45'36"},
        },
        {
            ra  => '6h30′3.6″',
            dec => '15°45′36″',
        },
        {
            ra  => '6.501',
            dec => '15.76',
        },
    );

    is(
        {Astro::DSS::JPEG::_convert_coordinates(%$_)},
        {
            ra  => 6.501,
            dec => 15.76
        },
        'Converted coords'
    ) for @test;
    is(warnings {Astro::DSS::JPEG::_convert_coordinates()},
        [], 'No warnings on undef');
    is(
        warnings {Astro::DSS::JPEG::_convert_coordinates(ra => 1)},
        [],
        'No warnings on undef dec'
    );
    is(
        warnings {Astro::DSS::JPEG::_convert_coordinates(dec => 1)},
        [],
        'No warnings on undef RA'
    );
    is(
        {Astro::DSS::JPEG::_convert_coordinates(ra => '-0 45 36', dec => '-15 45 36')},
        {ra => -0.76, dec => -15.76},
        'Converted negative coord'
    );
};

subtest '_process_options' => sub {
    my $default = {
        angular_size   => 30,
        angular_size_y => 30,



( run in 0.843 second using v1.01-cache-2.11-cpan-97f6503c9c8 )