Implement tests including test failure
This commit is contained in:
parent
9086e5dba7
commit
ea6a903d8a
1 changed files with 36 additions and 3 deletions
|
@ -2,22 +2,55 @@
|
|||
|
||||
namespace Tests\Unit\Importer;
|
||||
|
||||
use App\Importer\AssetImporter;
|
||||
use App\Models\Statuslabel;
|
||||
use Tests\TestCase;
|
||||
use function Livewire\invade;
|
||||
|
||||
class AssetImportTest extends TestCase
|
||||
{
|
||||
public function test_uses_first_deployable_status_label_as_default_if_one_exists()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
Statuslabel::truncate();
|
||||
|
||||
$pendingStatusLabel = Statuslabel::factory()->pending()->create();
|
||||
$readyToDeployStatusLabel = Statuslabel::factory()->readyToDeploy()->create();
|
||||
|
||||
$importer = new AssetImporter('assets.csv');
|
||||
|
||||
$this->assertEquals(
|
||||
$readyToDeployStatusLabel->id,
|
||||
invade($importer)->defaultStatusLabelId
|
||||
);
|
||||
}
|
||||
|
||||
public function test_uses_first_status_label_as_default_if_deployable_status_label_does_not_exist()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
Statuslabel::truncate();
|
||||
|
||||
$statusLabel = Statuslabel::factory()->pending()->create();
|
||||
|
||||
$importer = new AssetImporter('assets.csv');
|
||||
|
||||
$this->assertEquals(
|
||||
$statusLabel->id,
|
||||
invade($importer)->defaultStatusLabelId
|
||||
);
|
||||
}
|
||||
|
||||
public function test_creates_default_status_label_if_one_does_not_exist()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
Statuslabel::truncate();
|
||||
|
||||
$this->assertEquals(0, Statuslabel::count());
|
||||
|
||||
$importer = new AssetImporter('assets.csv');
|
||||
|
||||
$this->assertEquals(1, Statuslabel::count());
|
||||
|
||||
$this->assertEquals(
|
||||
Statuslabel::first()->id,
|
||||
invade($importer)->defaultStatusLabelId
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue