Files
animethemes-server/tests/Unit/Actions/Storage/Base/PruneResultsTest.php
T
2025-07-29 23:31:12 -03:00

49 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
use App\Actions\Storage\Base\PruneResults;
use App\Enums\Actions\ActionStatus;
uses(Illuminate\Foundation\Testing\WithFaker::class);
test('default', function () {
$pruneResults = new PruneResults(fake()->word());
$result = $pruneResults->toActionResult();
$this->assertTrue($result->hasFailed());
});
test('failed', function () {
$prunings = [];
foreach (range(0, fake()->randomDigitNotNull()) as $ignored) {
$prunings[fake()->word()] = true;
}
foreach (range(0, fake()->randomDigitNotNull()) as $ignored) {
$prunings[fake()->word()] = false;
}
$pruneResults = new PruneResults(fake()->word(), $prunings);
$result = $pruneResults->toActionResult();
$this->assertTrue($result->hasFailed());
});
test('passed', function () {
$prunings = [];
foreach (range(0, fake()->randomDigitNotNull()) as $ignored) {
$prunings[fake()->word()] = true;
}
$pruneResults = new PruneResults(fake()->word(), $prunings);
$result = $pruneResults->toActionResult();
$this->assertTrue($result->getStatus() === ActionStatus::PASSED);
});