TenantAtlas/tests/Unit/WindowsDriverUpdateProfileNormalizerTest.php
Ahmed Darrazi de199ef476 fix(tests): remove per-file TestCase uses
Pest v4 discovery fails when unit tests re-bind the test case with uses(TestCase::class). Remove per-file bindings and keep RefreshDatabase where needed. Also update RunBackupScheduleJobTest to pass BulkOperationService when calling handle() manually.
2026-01-08 01:38:54 +01:00

36 lines
1.2 KiB
PHP

<?php
use App\Services\Intune\PolicyNormalizer;
it('normalizes windows driver update profiles into readable settings', function () {
$normalizer = app(PolicyNormalizer::class);
$snapshot = [
'@odata.type' => '#microsoft.graph.windowsDriverUpdateProfile',
'displayName' => 'Driver Updates A',
'description' => 'Drivers rollout policy',
'approvalType' => 'automatic',
'deploymentDeferralInDays' => 7,
'deviceReporting' => 12,
'newUpdates' => 3,
'inventorySyncStatus' => [
'driverInventorySyncState' => 'success',
'lastSuccessfulSyncDateTime' => '2026-01-01T00:00:00Z',
],
];
$result = $normalizer->normalize($snapshot, 'windowsDriverUpdateProfile', 'windows');
expect($result['status'])->toBe('success');
expect($result['settings'])->toBeArray()->not->toBeEmpty();
$driverBlock = collect($result['settings'])
->first(fn (array $block) => ($block['title'] ?? null) === 'Driver Update Profile');
expect($driverBlock)->not->toBeNull();
$keys = collect($driverBlock['entries'] ?? [])->pluck('key')->all();
expect($keys)->toContain('Approval type', 'Deployment deferral (days)', 'Devices reporting', 'New driver updates');
});