mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-08-10 01:51:18 +10:00
Deleted Test-WinUtilPackageManager.ps1 + custom winget and choco installs + remove winget/choco enums and exeptions (#4606)
* Update Invoke-WPFGetInstalled.ps1 * Update Install-WinUtilWinget.ps1 * Update Install-WinUtilChoco.ps1 * Update Install-WinUtilChoco.ps1 * Update Install-WinUtilWinget.ps1 * Delete functions/private/Test-WinUtilPackageManager.ps1 * Update Install-WinUtilChoco.ps1 * Update Install-WinUtilWinget.ps1 * Update Install-WinUtilChoco.ps1 * Update Invoke-WPFGetInstalled.ps1 * Update Invoke-WPFGetInstalled.ps1 * Update Install-WinUtilChoco.ps1 * Update Install-WinUtilWinget.ps1 * Update Install-WinUtilWinget.ps1 * Update Install-WinUtilChoco.ps1 * Update Install-WinUtilWinget.ps1 * Update Install-WinUtilChoco.ps1 * Update Install-WinUtilWinget.ps1 * Update Install-WinUtilChoco.ps1 * Update Install-WinUtilChoco.ps1 * Update Install-WinUtilChoco.ps1 * Update Install-WinUtilChoco.ps1 * Update Install-WinUtilWinget.ps1 * Fixed lastrun.json * refactor: remove PackageManagers enum and unused custom exception classes * Update Invoke-WPFUIElements.ps1 * Update Get-WinUtilSelectedPackages.ps1 * Update Set-Preferences.ps1 * Update main.ps1 * Complete package manager enum removal Use string package-manager preferences throughout the remaining helpers and focused tests. Restore the existing Winget install flow and package-manager probe helper so PR 4606 keeps the current WinGet repair method. * Fix string keyed package split --------- Co-authored-by: Chris Titus <contact@christitus.com>
This commit is contained in:
+15
-25
@@ -5,16 +5,6 @@
|
||||
BeforeAll {
|
||||
$script:repoRoot = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
|
||||
|
||||
if (-not ("PackageManagers" -as [type])) {
|
||||
Add-Type @"
|
||||
public enum PackageManagers
|
||||
{
|
||||
Winget,
|
||||
Choco
|
||||
}
|
||||
"@
|
||||
}
|
||||
|
||||
. (Join-Path $script:repoRoot "functions\private\Get-WinUtilSelectedPackages.ps1")
|
||||
. (Join-Path $script:repoRoot "functions\private\Test-WinUtilPackageManager.ps1")
|
||||
. (Join-Path $script:repoRoot "functions\private\Install-WinUtilProgramWinget.ps1")
|
||||
@@ -35,10 +25,10 @@ Describe "Get-WinUtilSelectedPackages" {
|
||||
[pscustomobject]@{ winget = "VideoLAN.VLC"; choco = "vlc" }
|
||||
)
|
||||
|
||||
$result = Get-WinUtilSelectedPackages -PackageList $packages -Preference ([PackageManagers]::Winget)
|
||||
$result = Get-WinUtilSelectedPackages -PackageList $packages -Preference "Winget"
|
||||
|
||||
(@($result[[PackageManagers]::Winget]) -join "|") | Should -Be "Git.Git|VideoLAN.VLC"
|
||||
@($result[[PackageManagers]::Choco]).Count | Should -Be 0
|
||||
(@($result["Winget"]) -join "|") | Should -Be "Git.Git|VideoLAN.VLC"
|
||||
@($result["Choco"]).Count | Should -Be 0
|
||||
}
|
||||
|
||||
It "uses choco IDs and falls back to winget for na or missing choco IDs" {
|
||||
@@ -48,10 +38,10 @@ Describe "Get-WinUtilSelectedPackages" {
|
||||
[pscustomobject]@{ winget = "Mozilla.Firefox" }
|
||||
)
|
||||
|
||||
$result = Get-WinUtilSelectedPackages -PackageList $packages -Preference ([PackageManagers]::Choco)
|
||||
$result = Get-WinUtilSelectedPackages -PackageList $packages -Preference "Choco"
|
||||
|
||||
(@($result[[PackageManagers]::Choco]) -join "|") | Should -Be "git"
|
||||
(@($result[[PackageManagers]::Winget]) -join "|") | Should -Be "VideoLAN.VLC|Mozilla.Firefox"
|
||||
(@($result["Choco"]) -join "|") | Should -Be "git"
|
||||
(@($result["Winget"]) -join "|") | Should -Be "VideoLAN.VLC|Mozilla.Firefox"
|
||||
}
|
||||
|
||||
It "skips blank, na, and missing package IDs" {
|
||||
@@ -62,10 +52,10 @@ Describe "Get-WinUtilSelectedPackages" {
|
||||
[pscustomobject]@{ winget = " " }
|
||||
)
|
||||
|
||||
$result = Get-WinUtilSelectedPackages -PackageList $packages -Preference ([PackageManagers]::Winget)
|
||||
$result = Get-WinUtilSelectedPackages -PackageList $packages -Preference "Winget"
|
||||
|
||||
@($result[[PackageManagers]::Winget]).Count | Should -Be 0
|
||||
@($result[[PackageManagers]::Choco]).Count | Should -Be 0
|
||||
@($result["Winget"]).Count | Should -Be 0
|
||||
@($result["Choco"]).Count | Should -Be 0
|
||||
}
|
||||
|
||||
It "deduplicates package IDs" {
|
||||
@@ -75,17 +65,17 @@ Describe "Get-WinUtilSelectedPackages" {
|
||||
[pscustomobject]@{ winget = "VideoLAN.VLC"; choco = "vlc" }
|
||||
)
|
||||
|
||||
$result = Get-WinUtilSelectedPackages -PackageList $packages -Preference ([PackageManagers]::Choco)
|
||||
$result = Get-WinUtilSelectedPackages -PackageList $packages -Preference "Choco"
|
||||
|
||||
(@($result[[PackageManagers]::Choco]) -join "|") | Should -Be "git|vlc"
|
||||
@($result[[PackageManagers]::Winget]).Count | Should -Be 0
|
||||
(@($result["Choco"]) -join "|") | Should -Be "git|vlc"
|
||||
@($result["Winget"]).Count | Should -Be 0
|
||||
}
|
||||
|
||||
It "returns empty package lists for an empty selection" {
|
||||
$result = Get-WinUtilSelectedPackages -PackageList @() -Preference ([PackageManagers]::Winget)
|
||||
$result = Get-WinUtilSelectedPackages -PackageList @() -Preference "Winget"
|
||||
|
||||
@($result[[PackageManagers]::Winget]).Count | Should -Be 0
|
||||
@($result[[PackageManagers]::Choco]).Count | Should -Be 0
|
||||
@($result["Winget"]).Count | Should -Be 0
|
||||
@($result["Choco"]).Count | Should -Be 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user