- Implement Spec 116 baseline capture/compare + coverage guard\n- Add UI surfaces and widgets for baseline compare\n- Add tests and research report
60 lines
1.7 KiB
PHP
60 lines
1.7 KiB
PHP
<?php
|
|
|
|
use App\Services\Baselines\InventoryMetaContract;
|
|
|
|
it('builds a deterministic v1 contract regardless of input ordering', function () {
|
|
$builder = app(InventoryMetaContract::class);
|
|
|
|
$a = $builder->build(
|
|
policyType: 'deviceConfiguration',
|
|
subjectExternalId: 'policy-a',
|
|
metaJsonb: [
|
|
'etag' => 'E1',
|
|
'odata_type' => '#microsoft.graph.deviceConfiguration',
|
|
'scope_tag_ids' => ['2', '1'],
|
|
'assignment_target_count' => 3,
|
|
],
|
|
);
|
|
|
|
$b = $builder->build(
|
|
policyType: 'deviceConfiguration',
|
|
subjectExternalId: 'policy-a',
|
|
metaJsonb: [
|
|
'assignment_target_count' => 3,
|
|
'scope_tag_ids' => ['1', '2'],
|
|
'odata_type' => '#microsoft.graph.deviceConfiguration',
|
|
'etag' => 'E1',
|
|
],
|
|
);
|
|
|
|
expect($a)->toBe($b);
|
|
});
|
|
|
|
it('represents missing signals as null (not omitted)', function () {
|
|
$builder = app(InventoryMetaContract::class);
|
|
|
|
$contract = $builder->build(
|
|
policyType: 'deviceConfiguration',
|
|
subjectExternalId: 'policy-a',
|
|
metaJsonb: [],
|
|
);
|
|
|
|
expect($contract)->toHaveKeys([
|
|
'version',
|
|
'policy_type',
|
|
'subject_external_id',
|
|
'odata_type',
|
|
'etag',
|
|
'scope_tag_ids',
|
|
'assignment_target_count',
|
|
]);
|
|
|
|
expect($contract['version'])->toBe(1);
|
|
expect($contract['policy_type'])->toBe('deviceConfiguration');
|
|
expect($contract['subject_external_id'])->toBe('policy-a');
|
|
expect($contract['odata_type'])->toBeNull();
|
|
expect($contract['etag'])->toBeNull();
|
|
expect($contract['scope_tag_ids'])->toBeNull();
|
|
expect($contract['assignment_target_count'])->toBeNull();
|
|
});
|