File: sass-unable-to-download.t

package info (click to toggle)
libmojolicious-plugin-assetpack-perl 2.15-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,888 kB
  • sloc: perl: 1,503; javascript: 52; makefile: 8; sh: 2
file content (30 lines) | stat: -rw-r--r-- 1,142 bytes parent folder | download | duplicates (2)
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
29
30
use lib '.';
use t::Helper;
plan skip_all => 'TEST_ONLINE=1'   unless $ENV{TEST_ONLINE} or -e '.test-everything';
plan skip_all => 'cpanm CSS::Sass' unless eval 'use CSS::Sass 3.3.0;1';

my ($t, @message);
my $url = 'https://raw.githubusercontent.com/select2/select2/master/src/scss/core.scss';

run();
ok + (grep {/Caching/} @message), 'cached assets' or diag join ',', @message;
ok + (grep {/Unable to download.*_layout\.scss/} @message), 'unable to download' or map { diag $_ } @message;

run();
ok !(grep {/Caching/} @message),                           'assets are already cached'     or diag join ',', @message;
ok !(grep {/Unable to download.*_layout\.scss/} @message), 'assets are already downloaded' or diag join ',', @message;

done_testing;

sub run {
  @message = ();
  $t       = t::Helper->t(pipes => ['Sass']);
  $t->app->log->on(message => sub { shift; push @message, join ' ', @_ });
  $t->app->asset->process('app.css' => $url);
  $t->get_ok('/')->status_is(200);
  $t->get_ok($t->tx->res->dom->at('link[href]')->{href} || '/nope')->status_is(200)->content_like(qr{select2});
}

__DATA__
@@ index.html.ep
%= asset 'app.css'