tests/ServicesDedupe.Tests.ps1
|
$moduleRoot = Split-Path -Parent $PSScriptRoot Import-Module (Join-Path $moduleRoot 'Octa.psd1') -Force Get-ChildItem -Path (Join-Path $moduleRoot 'categories') -Filter '*.ps1' | ForEach-Object { . $_.FullName } Describe 'services category does not duplicate an existing category (FR-037)' { It 'contains none of the exact service names telemetry already hardcodes' { # Telemetry.ps1 is the only other category that targets services by an exact, # hardcoded name (oem-suites matches by regex pattern, not exact names, so it can't # collide with this catalog's literal service names the same way). $telemetryServiceNames = @('DiagTrack', 'dmwappushservice') $catalogNames = $script:OctaServicesCatalog | ForEach-Object { $_.Name } foreach ($name in $telemetryServiceNames) { ($catalogNames -contains $name) | Should Be $false } } It 'contains no duplicate entries within its own catalog' { $catalogNames = $script:OctaServicesCatalog | ForEach-Object { $_.Name } $uniqueNames = $catalogNames | Select-Object -Unique $uniqueNames.Count | Should Be $catalogNames.Count } It 'includes SysMain as a Moderate-risk Disabled candidate (011-competitive-latency-tuning)' { $sysMain = $script:OctaServicesCatalog | Where-Object { $_.Name -eq 'SysMain' } $sysMain | Should Not BeNullOrEmpty $sysMain.Target | Should Be 'Disabled' $sysMain.RiskLevel | Should Be 'Moderate' } } |