39 lines
1.3 KiB
PHP
39 lines
1.3 KiB
PHP
<?php
|
|
|
|
use App\Services\Intune\PolicyNormalizer;
|
|
use Tests\TestCase;
|
|
|
|
uses(TestCase::class);
|
|
|
|
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');
|
|
});
|