Add policy support for linux (#272579)

This commit is contained in:
Paul
2025-10-22 16:01:59 -07:00
committed by GitHub
parent 9308f9a06e
commit e81696f60d
34 changed files with 600 additions and 21 deletions

View File

@@ -13,7 +13,7 @@ import { ObjectPolicy } from '../policies/objectPolicy';
import { StringEnumPolicy } from '../policies/stringEnumPolicy';
import { StringPolicy } from '../policies/stringPolicy';
import { Policy, ProductJson } from '../policies/types';
import { renderGP, renderMacOSPolicy } from '../policies/render';
import { renderGP, renderMacOSPolicy, renderJsonPolicies } from '../policies/render';
const PolicyTypes = [
BooleanPolicy,
@@ -492,4 +492,17 @@ suite('Policy E2E conversion', () => {
assert.strictEqual(frFrAdml.contents, expectedContent, 'Windows fr-fr ADML should match the fixture');
});
test('should render Linux policy JSON from policies list', async () => {
const parsedPolicies = parsePolicies(policies);
const result = renderJsonPolicies(parsedPolicies);
// Load the expected fixture file
const fixturePath = path.join(__dirname, 'fixtures', 'policies', 'linux', 'policy.json');
const expectedContent = await fs.readFile(fixturePath, 'utf-8');
const expectedJson = JSON.parse(expectedContent);
// Compare the rendered JSON with the fixture
assert.deepStrictEqual(result, expectedJson, 'Linux policy JSON should match the fixture');
});
});