Some checks failed
Main Confidence / confidence (push) Failing after 48s
## Summary - add derived onboarding readiness to the managed tenant onboarding workflow and multi-draft picker - keep provider-specific permission diagnostics secondary while preserving canonical `Open operation` and existing onboarding action semantics - add spec-kit artifacts for `240-tenant-onboarding-readiness` and align roadmap/spec-candidate planning notes - unify the required-permissions empty state copy to English ## Validation - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/RequiredPermissions/RequiredPermissionsEmptyStateTest.php` - `cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agent` - browser smoke exercised the onboarding picker, route-bound mismatch readiness state, canonical `Open operation` path, and local fixture cleanup ## Notes - branch includes the generated spec artifacts under `specs/240-tenant-onboarding-readiness/` - temporary browser smoke tenants/drafts/runs were cleaned from the local environment after validation Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #277
51 lines
1.7 KiB
PHP
51 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Services\Intune\TenantRequiredPermissionsViewModelBuilder;
|
|
use Carbon\CarbonImmutable;
|
|
|
|
it('marks freshness as stale when last refreshed is missing', function (): void {
|
|
$freshness = TenantRequiredPermissionsViewModelBuilder::deriveFreshness(
|
|
null,
|
|
CarbonImmutable::parse('2026-02-08 12:00:00'),
|
|
);
|
|
|
|
expect($freshness['last_refreshed_at'])->toBeNull()
|
|
->and($freshness['is_stale'])->toBeTrue();
|
|
});
|
|
|
|
it('marks freshness as stale when last refreshed is older than 30 days', function (): void {
|
|
$freshness = TenantRequiredPermissionsViewModelBuilder::deriveFreshness(
|
|
CarbonImmutable::parse('2026-01-08 11:59:59'),
|
|
CarbonImmutable::parse('2026-02-08 12:00:00'),
|
|
);
|
|
|
|
expect($freshness['is_stale'])->toBeTrue();
|
|
});
|
|
|
|
it('marks freshness as not stale when last refreshed is exactly 30 days old', function (): void {
|
|
$freshness = TenantRequiredPermissionsViewModelBuilder::deriveFreshness(
|
|
CarbonImmutable::parse('2026-01-09 12:00:00'),
|
|
CarbonImmutable::parse('2026-02-08 12:00:00'),
|
|
);
|
|
|
|
expect($freshness['is_stale'])->toBeFalse();
|
|
});
|
|
|
|
it('keeps the thirty day freshness boundary exact to the second', function (): void {
|
|
$reference = CarbonImmutable::parse('2026-02-08 12:00:00');
|
|
|
|
$insideWindow = TenantRequiredPermissionsViewModelBuilder::deriveFreshness(
|
|
CarbonImmutable::parse('2026-01-09 12:00:01'),
|
|
$reference,
|
|
);
|
|
$outsideWindow = TenantRequiredPermissionsViewModelBuilder::deriveFreshness(
|
|
CarbonImmutable::parse('2026-01-09 11:59:59'),
|
|
$reference,
|
|
);
|
|
|
|
expect($insideWindow['is_stale'])->toBeFalse()
|
|
->and($outsideWindow['is_stale'])->toBeTrue();
|
|
});
|