tests/GamingCache.Tests.ps1

$moduleRoot = Split-Path -Parent $PSScriptRoot
Import-Module (Join-Path $moduleRoot 'Octa.psd1') -Force

Describe 'Get-OctaCleanupTargets gaming platform caches (009 US3)' {
    It 'never throws regardless of which gaming platforms are installed' {
        { Get-OctaCleanupTargets | Out-Null } | Should Not Throw
    }

    It 'only reports a gaming cache target when its real folder exists on this machine' {
        $targets = @(Get-OctaCleanupTargets)
        $gamingNames = @('Steam shader cache', 'Epic Games Launcher cache', 'NVIDIA DirectX shader cache', 'NVIDIA OpenGL shader cache')

        foreach ($name in $gamingNames) {
            $target = $targets | Where-Object Name -eq $name
            if ($target) {
                # If reported, it must correspond to a real, currently-existing folder path.
                $target.Paths | Should Not BeNullOrEmpty
                $target.MeasuredBytes | Should BeGreaterThan -1
            }
        }
    }

    It 'reports NVIDIA DirectX shader cache as present (real, verified folder on this dev machine - research.md)' {
        $targets = @(Get-OctaCleanupTargets)
        ($targets | Where-Object Name -eq 'NVIDIA DirectX shader cache') | Should Not Be $null
    }
}