Describe 'Published manifest schemas' { It 'accepts schema annotations in checked-in profiles' { foreach ($profile in Get-ChildItem "$PSScriptRoot/../profiles/*.json") { Get-Content $profile.FullName -Raw | Test-Json -SchemaFile "$PSScriptRoot/../schemas/profile.schema.json" | Should -BeTrue } } It 'requires the portable checksum and forbids portable machine scope' { $profile = [ordered]@{ schemaVersion = 1; name = 'test'; packages = @( [ordered]@{ id = 'app'; provider = 'portable'; source = 'example'; version = '1.0'; update = 'pinned'; url = 'https://example.org/app.zip'; executable = 'app.exe' } ) } $schema = "$PSScriptRoot/../schemas/profile.schema.json" $profile | ConvertTo-Json -Depth 8 | Test-Json -SchemaFile $schema -ErrorAction SilentlyContinue | Should -BeFalse $profile.packages[0].sha256 = 'a' * 64 $profile | ConvertTo-Json -Depth 8 | Test-Json -SchemaFile $schema | Should -BeTrue $profile.packages[0].scope = 'machine' $profile | ConvertTo-Json -Depth 8 | Test-Json -SchemaFile $schema -ErrorAction SilentlyContinue | Should -BeFalse } It 'requires a display name and safe extensions for portable file handlers' { $schema = "$PSScriptRoot/../schemas/profile.schema.json" $package = [ordered]@{ id = 'app'; provider = 'portable'; source = 'example'; version = '1.0'; update = 'pinned'; url = 'https://example.org/app.zip'; executable = 'app.exe'; sha256 = 'a' * 64; fileAssociations = @('.pdf') } $profile = [ordered]@{ schemaVersion = 1; name = 'test'; packages = @($package) } $profile | ConvertTo-Json -Depth 8 | Test-Json -SchemaFile $schema -ErrorAction SilentlyContinue | Should -BeFalse $package.displayName = 'Example App' $profile | ConvertTo-Json -Depth 8 | Test-Json -SchemaFile $schema | Should -BeTrue $package.fileAssociations = @('pdf') $profile | ConvertTo-Json -Depth 8 | Test-Json -SchemaFile $schema -ErrorAction SilentlyContinue | Should -BeFalse $package.fileAssociations = @('.pdf') $package.fileAssociationIcon = '../outside.ico' $profile | ConvertTo-Json -Depth 8 | Test-Json -SchemaFile $schema -ErrorAction SilentlyContinue | Should -BeFalse $package.fileAssociationIcon = 'assets/example.ico' $profile | ConvertTo-Json -Depth 8 | Test-Json -SchemaFile $schema | Should -BeTrue } }