38 lines
921 B
Perl
38 lines
921 B
Perl
use 5.32.1;
|
|
|
|
use Test::Most tests => 4;
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
use Path::Tiny;
|
|
use Test::MockModule;
|
|
|
|
use Data::Dumper;
|
|
|
|
use BeastBB::Constants qw/ConfigFile/;
|
|
|
|
{
|
|
use_ok 'BeastBB';
|
|
}
|
|
|
|
{
|
|
# GIVEN
|
|
my $path_tiny_tempdir_home = Path::Tiny->tempdir;
|
|
my $mock_module_constants = Test::MockModule->new('BeastBB::Constants');
|
|
$mock_module_constants->mock(
|
|
HomeDir => sub {
|
|
return Mojo::File->new($path_tiny_tempdir_home . '');
|
|
}
|
|
);
|
|
my $beastbb = BeastBB->new;
|
|
# WHEN
|
|
$beastbb->PrepareConfig;
|
|
# THEN
|
|
my $config = eval ConfigFile->slurp;
|
|
ok length $config->{secrets}[0] == 128, 'The config has been successfully created';
|
|
is_deeply $beastbb->config, $config, 'The populated in program config matches the content of the file.';
|
|
$config->{secrets} = [];
|
|
is_deeply $config, { secrets => [] }, 'The config matches the expected structure.';
|
|
}
|