Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
ryfu-msft committed Nov 30, 2023
1 parent 8da9802 commit 43f0df5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/actions/spelling/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ nonexistentsetting
norestart
normalizednameandpublisher
normalizedpackagenameandpublisher
notcontains
NTSTATUS
nullsoft
nunit
Expand Down
16 changes: 9 additions & 7 deletions src/PowerShell/tests/Microsoft.WinGet.DSC.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ Describe 'WinGetPackage' {
$result.InDesiredState | Should -Be $false
}

It 'Set WingetPackage | Present(Install)' {
It 'Install WinGetPackage' {
InvokeWinGetDSC -Name WinGetPackage -Method Set -Property @{ Id = $testPackageId; Version = $testPackageVersion }

# Verify package installed.
Expand All @@ -191,27 +191,29 @@ Describe 'WinGetPackage' {
$result.InstalledVersion | Should -Be 1.0.0.0
}

It 'Update WingetPackage' {
It 'Update WinGetPackage' {
$testResult = InvokeWinGetDSC -Name WinGetPackage -Method Test -Property @{ Id = $testPackageId; UseLatest = $true }
$testResult.InDesiredState | Should -Be $false

# Verify package updated.
InvokeWinGetDSC -Name WinGetPackage -Method Set -Property @{ Id = $testPackageId; UseLatest = $true }

# Verify package updated.
$result = InvokeWinGetDSC -Name WinGetPackage -Method Get -Property @{ Id = $testPackageId; UseLatest = $true }
$result.IsInstalled | Should -Be $true
$result.IsUpdateAvailable | Should -Be $false
$result.InstalledVersion | Should -Not -Be 1.0.0.0
}

It 'Set WingetPackage | Absent(Uninstall)' {
It 'Uninstall WinGetPackage' {
InvokeWinGetDSC -Name WinGetPackage -Method Set -Property @{ Id = $testPackageId; UseLatest = $true }

$testResult = InvokeWinGetDSC -Name WinGetPackage -Method Test -Property @{ Ensure = 'Absent'; Id = $testPackageId; UseLatest = $true }
$testResult = InvokeWinGetDSC -Name WinGetPackage -Method Test -Property @{ Ensure = 'Absent'; Id = $testPackageId }
$testResult.InDesiredState | Should -Be $false

InvokeWinGetDSC -Name WinGetPackage -Method Set -Property @{ Ensure = 'Absent'; Id = $testPackageId }

# Verify package uninstalled.
InvokeWinGetDSC -Name WinGetPackage -Method Set -Property @{ Ensure = 'Absent'; Id = $testPackageId; UseLatest = $true }
$result = InvokeWinGetDSC -Name WinGetPackage -Method Get -Property @{ Ensure = 'Absent'; Id = $testPackageId; UseLatest = $true }
$result = InvokeWinGetDSC -Name WinGetPackage -Method Get -Property @{ Ensure = 'Absent'; Id = $testPackageId }
$result.IsInstalled | Should -Be $false
}

Expand Down

0 comments on commit 43f0df5

Please sign in to comment.