mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2026-08-23 08:02:07 +00:00
Add comprehensive test suite, fix minor issues, rename function and file names to match approved verbs (#708)
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
BeforeAll {
|
||||
$wingetListScriptPath = Join-Path $PSScriptRoot '..\Scripts\AppRemoval\Test-AppInWingetList.ps1'
|
||||
. $wingetListScriptPath
|
||||
}
|
||||
|
||||
Describe 'Test-AppInWingetList' {
|
||||
BeforeAll {
|
||||
$installedApps = @(
|
||||
[PSCustomObject]@{ Id = 'Microsoft.Copilot' }
|
||||
[PSCustomObject]@{ Id = 'Microsoft.EdgeDev' }
|
||||
[PSCustomObject]@{ Id = 'Contoso.Music-Player' }
|
||||
)
|
||||
}
|
||||
|
||||
It 'matches an exact winget ID' {
|
||||
Test-AppInWingetList -appId 'Microsoft.Copilot' -InstalledList $installedApps | Should -BeTrue
|
||||
}
|
||||
|
||||
It '<Case>' -ForEach @(
|
||||
@{ Case = 'matches a delimited substring'; AppId = 'Music'; Expected = $true }
|
||||
@{ Case = 'does not match an alphanumeric continuation'; AppId = 'Microsoft.Edge'; Expected = $false }
|
||||
) {
|
||||
Test-AppInWingetList -appId $AppId -InstalledList $installedApps | Should -Be $Expected
|
||||
}
|
||||
|
||||
It 'returns false for <Case>' -ForEach @(
|
||||
@{ Case = 'an empty installed-app list'; AppId = 'Microsoft.Copilot'; InstalledList = @() }
|
||||
@{ Case = 'an app that is not installed'; AppId = 'Missing.App'; InstalledList = $null }
|
||||
) {
|
||||
$list = if ($null -eq $InstalledList) { $installedApps } else { $InstalledList }
|
||||
Test-AppInWingetList -appId $AppId -InstalledList $list | Should -BeFalse
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user