Skip to content

Commit

Permalink
test(engine): add unit tests for Stop.pm
Browse files Browse the repository at this point in the history
  • Loading branch information
scriptprivate committed Jul 1, 2024
1 parent 587f5e7 commit 606fcd2
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/Stop.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env perl

use strict;
use warnings;
use Test::More;
use Test::MockModule;
use lib '../lib/';
use Nipe::Engine::Stop;
use Nipe::Utils::Device;

my $mock_device = Test::MockModule -> new('Nipe::Utils::Device');
$mock_device -> mock('new', sub {
return (
'distribution' => 'debian',
'username' => 'debian-tor'
);
});

my $mock_stop = Test::MockModule -> new('Nipe::Engine::Stop');
$mock_stop -> mock('system', sub { return 1; });

{
my $stop = Nipe::Engine::Stop -> new();
ok($stop, 'Stop module initialized correctly');
}

$mock_device -> unmock_all();
$mock_stop -> unmock_all();

done_testing();

0 comments on commit 606fcd2

Please sign in to comment.