summaryrefslogtreecommitdiffstats
path: root/t/cache_contains_data.t
diff options
context:
space:
mode:
Diffstat (limited to 't/cache_contains_data.t')
-rw-r--r--t/cache_contains_data.t22
1 files changed, 22 insertions, 0 deletions
diff --git a/t/cache_contains_data.t b/t/cache_contains_data.t
new file mode 100644
index 0000000..2187ab0
--- /dev/null
+++ b/t/cache_contains_data.t
@@ -0,0 +1,22 @@
+use strict;
+use warnings;
+
+use Test::More;
+use Test::MockObject;
+use Test::Differences;
+
+use App::BorgRestore;
+
+my $db = Test::MockObject->new();
+my $app = App::BorgRestore->new_no_defaults({db => $db});
+
+$db->mock('get_archive_names', sub {return [qw(a b c)];});
+is($app->cache_contains_data(), 1);
+
+$db->mock('get_archive_names', sub {return [];});
+is($app->cache_contains_data(), 0);
+
+$db->mock('get_archive_names', sub {return [qw(a)];});
+is($app->cache_contains_data(), 1);
+
+done_testing;