26 lines
1.3 KiB
PowerShell
26 lines
1.3 KiB
PowerShell
BeforeAll {
|
|
$script:exporterPath = "$PSScriptRoot/../tools/Export-MpcHcSettings.ps1"
|
|
$tokens = $null
|
|
$errors = $null
|
|
$ast = [System.Management.Automation.Language.Parser]::ParseFile($exporterPath, [ref]$tokens, [ref]$errors)
|
|
if ($errors.Count -gt 0) { throw "MPC-HC exporter does not parse: $($errors[0].Message)" }
|
|
$functionAst = $ast.Find({
|
|
param($node)
|
|
$node -is [System.Management.Automation.Language.FunctionDefinitionAst] -and $node.Name -eq 'Test-PrivateMpcHcSetting'
|
|
}, $true)
|
|
. ([scriptblock]::Create($functionAst.Extent.Text))
|
|
}
|
|
|
|
Describe 'MPC-HC export filtering' {
|
|
It 'excludes history, device identities, paths, and URLs' {
|
|
Test-PrivateMpcHcSetting -RelativePath 'PlaylistHistory\item' -Name Position -Value 42 | Should -BeTrue
|
|
Test-PrivateMpcHcSetting -RelativePath Settings -Name AudioDevice -Value speakers | Should -BeTrue
|
|
Test-PrivateMpcHcSetting -RelativePath Settings -Name Logo -Value 'C:\Users\Alice\logo.png' | Should -BeTrue
|
|
Test-PrivateMpcHcSetting -RelativePath Settings -Name Server -Value 'https://example.test' | Should -BeTrue
|
|
}
|
|
|
|
It 'keeps ordinary portable playback settings' {
|
|
Test-PrivateMpcHcSetting -RelativePath Settings -Name Volume -Value 80 | Should -BeFalse
|
|
}
|
|
}
|