34 lines
1.2 KiB
PHP
34 lines
1.2 KiB
PHP
<?php
|
|
|
|
use App\Filament\Pages\DriftLanding;
|
|
use App\Models\InventorySyncRun;
|
|
use Filament\Facades\Filament;
|
|
use Livewire\Livewire;
|
|
|
|
test('drift landing exposes baseline/current run ids and timestamps', function () {
|
|
[$user, $tenant] = createUserWithTenant(role: 'manager');
|
|
$this->actingAs($user);
|
|
Filament::setTenant($tenant, true);
|
|
|
|
$scopeKey = hash('sha256', 'scope-landing-comparison-info');
|
|
|
|
$baseline = InventorySyncRun::factory()->for($tenant)->create([
|
|
'selection_hash' => $scopeKey,
|
|
'status' => InventorySyncRun::STATUS_SUCCESS,
|
|
'finished_at' => now()->subDays(2),
|
|
]);
|
|
|
|
$current = InventorySyncRun::factory()->for($tenant)->create([
|
|
'selection_hash' => $scopeKey,
|
|
'status' => InventorySyncRun::STATUS_SUCCESS,
|
|
'finished_at' => now()->subDay(),
|
|
]);
|
|
|
|
Livewire::test(DriftLanding::class)
|
|
->assertSet('scopeKey', $scopeKey)
|
|
->assertSet('baselineRunId', (int) $baseline->getKey())
|
|
->assertSet('currentRunId', (int) $current->getKey())
|
|
->assertSet('baselineFinishedAt', $baseline->finished_at->toDateTimeString())
|
|
->assertSet('currentFinishedAt', $current->finished_at->toDateTimeString());
|
|
});
|