TenantAtlas/tests/Unit/PolicyNormalizerSettingsCatalogTest.php
2025-12-14 20:23:18 +01:00

34 lines
1.1 KiB
PHP

<?php
use App\Services\Intune\PolicyNormalizer;
use App\Services\Intune\SnapshotValidator;
use Tests\TestCase;
uses(TestCase::class);
beforeEach(function () {
$this->normalizer = new PolicyNormalizer(new SnapshotValidator);
});
it('normalizes settings catalog settings into key value entries', function () {
$snapshot = [
'@odata.type' => '#microsoft.graph.deviceManagementConfigurationPolicy',
'settings' => [
['displayName' => 'Minimum PIN Length', 'value' => 12],
['definitionId' => 'winhello', 'value' => true],
],
];
$result = $this->normalizer->normalize($snapshot, 'settingsCatalogPolicy', 'windows');
expect($result['status'])->toBe('success');
expect($result)->toHaveKey('settings_table');
$rows = $result['settings_table']['rows'];
expect($rows[0]['definition'])->toBe('Minimum PIN Length');
expect($rows[0]['type'])->toBe('-');
expect($rows[0]['value'])->toBe('12');
expect($rows[1]['definition'])->toBe('winhello');
expect($rows[1]['type'])->toBe('-');
expect($rows[1]['value'])->toBe('true');
});