Skip to content

Commit

Permalink
more LibreCat.pm tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nics committed Apr 9, 2018
1 parent 1430883 commit 9b55f2f
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion t/LibreCat.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use Catmandu::Sane;
use POSIX qw(strftime);
use Test::More;
use Test::Exception;
use Path::Tiny;
use LibreCat;

# class methods and loading
Expand Down Expand Up @@ -37,6 +37,12 @@ isa_ok(

my $model = $instance->model('publication');

isa_ok(
$instance->model('publication'),
"LibreCat::Model::Publication",
"librecat->publication returns a LibreCat::Model::Publication"
);

$model->purge_all;

like($model->generate_id,
Expand Down Expand Up @@ -137,6 +143,28 @@ isa_ok(
ok(!$model->search_bag->get($id), '...purged (index)');
}

# timestamp

{
my $time = time;
my $str = $instance->timestamp($time);
is($str, strftime('%Y-%m-%dT%H:%M:%SZ', gmtime($time)));

$instance->config->{time_format} = '%Y-%m-%d';
$str = $instance->timestamp($time);
is($str, strftime('%Y-%m-%d', gmtime($time)));

ok($instance->timestamp, 'time argument is optional');
}

# searcher

isa_ok(
$instance->searcher,
"LibreCat::Search",
"librecat->search returns a LibreCat::Search"
);

# queue

isa_ok(
Expand Down

0 comments on commit 9b55f2f

Please sign in to comment.