tests/Gpu.Tests.ps1
|
$moduleRoot = Split-Path -Parent $PSScriptRoot Import-Module (Join-Path $moduleRoot 'Octa.psd1') -Force . (Join-Path $moduleRoot 'private\ActionHelpers.ps1') Get-ChildItem -Path (Join-Path $moduleRoot 'categories') -Filter '*.ps1' | ForEach-Object { . $_.FullName } Describe 'Get-OctaGpuActions' { $controllers = @(Get-CimInstance -ClassName Win32_VideoController -ErrorAction SilentlyContinue) $hasNvidia = $controllers | Where-Object { $_.AdapterCompatibility -match 'NVIDIA' -or $_.Name -match 'NVIDIA' } It 'returns only NVIDIA actions when an NVIDIA adapter is present, empty otherwise (US3)' { $actions = Get-OctaGpuActions if ($hasNvidia) { foreach ($a in $actions) { $a.TargetIdentifier | Should Match 'Class' $a.RiskLevel | Should Be 'Risky' } } else { @($actions).Count | Should Be 0 } } It 'never throws regardless of installed GPU vendor' { { Get-OctaGpuActions } | Should Not Throw } } |