diff --git a/.github/README.md b/.github/README.md index e1e1011..1ea1d65 100644 --- a/.github/README.md +++ b/.github/README.md @@ -1,7 +1,9 @@ +![Uninstall Teams](https://github.com/asheroto/UninstallTeams/assets/49938263/aaa5ab1a-40f3-4a38-bf44-5ee7dbece2df) + [![GitHub Release Date - Published_At](https://img.shields.io/github/release-date/asheroto/UninstallTeams)](https://github.com/asheroto/UninstallTeams/releases) -[![GitHub Downloads - All Releases](https://img.shields.io/github/downloads/asheroto/UninstallTeams/total)](https://github.com/sponsors/asheroto) +[![GitHub Downloads - All Releases](https://img.shields.io/github/downloads/asheroto/UninstallTeams/total)](https://github.com/asheroto/UninstallTeams/releases) [![GitHub Sponsor](https://img.shields.io/github/sponsors/asheroto?label=Sponsor&logo=GitHub)](https://github.com/sponsors/asheroto) -[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/asheroto) +Ko-Fi Button # UninstallTeams diff --git a/UninstallTeams.Tests.ps1 b/UninstallTeams.Tests.ps1 index 5571aec..43f031c 100644 --- a/UninstallTeams.Tests.ps1 +++ b/UninstallTeams.Tests.ps1 @@ -14,87 +14,87 @@ Describe "Get-ChatWidgetStatus Function" { Context "When the registry key is missing" { It "Should return 'Not Set'" { $status = Get-ChatWidgetStatus - if ($status -eq "Not Set") { - # Test passed - $true | Should -Be $true - } elseif ($status -eq "Hidden") { - # Test passed but with unexpected result, display a warning - Write-Warning "Unexpected result: The registry key is missing, but the status is 'Hidden'." - $true | Should -Be $true - } else { - # Test failed - Throw "Test failed: Unexpected status '$status' returned." - } + if ($status -eq "Unset (default is enabled)") + # Test passed + $true | Should -Be $true + } elseif ($status -eq "Hidden") { + # Test passed but with unexpected result, display a warning + Write-Warning "Unexpected result: The registry key is missing, but the status is 'Hidden'." + $true | Should -Be $true + } else { + # Test failed + Throw "Test failed: Unexpected status '$status' returned." } } +} - Context "When ChatIcon value is 1" { - It "Should return 'Enabled'" { - # Set the ChatIcon value to 1 - Set-ItemProperty -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\Windows Chat" -Name "ChatIcon" -Value 1 -Type DWord -Force - $status = Get-ChatWidgetStatus - $status | Should -Be "Enabled" - # Remove the ChatIcon value - Remove-ItemProperty -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\Windows Chat" -Name "ChatIcon" -Force - } +Context "When ChatIcon value is 1" { + It "Should return 'Enabled'" { + # Set the ChatIcon value to 1 + Set-ItemProperty -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\Windows Chat" -Name "ChatIcon" -Value 1 -Type DWord -Force + $status = Get-ChatWidgetStatus + $status | Should -Be "Enabled" + # Remove the ChatIcon value + Remove-ItemProperty -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\Windows Chat" -Name "ChatIcon" -Force } +} - Context "When ChatIcon value is 2" { - It "Should return 'Hidden'" { - # Set the ChatIcon value to 2 - Set-ItemProperty -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\Windows Chat" -Name "ChatIcon" -Value 2 -Type DWord -Force - $status = Get-ChatWidgetStatus - $status | Should -Be "Hidden" - # Remove the ChatIcon value - Remove-ItemProperty -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\Windows Chat" -Name "ChatIcon" -Force - } +Context "When ChatIcon value is 2" { + It "Should return 'Hidden'" { + # Set the ChatIcon value to 2 + Set-ItemProperty -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\Windows Chat" -Name "ChatIcon" -Value 2 -Type DWord -Force + $status = Get-ChatWidgetStatus + $status | Should -Be "Hidden" + # Remove the ChatIcon value + Remove-ItemProperty -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\Windows Chat" -Name "ChatIcon" -Force } +} - Context "When ChatIcon value is 3" { - It "Should return 'Disabled'" { - # Set the ChatIcon value to 3 - Set-ItemProperty -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\Windows Chat" -Name "ChatIcon" -Value 3 -Type DWord -Force - $status = Get-ChatWidgetStatus - $status | Should -Be "Disabled" - # Remove the ChatIcon value - Remove-ItemProperty -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\Windows Chat" -Name "ChatIcon" -Force - } +Context "When ChatIcon value is 3" { + It "Should return 'Disabled'" { + # Set the ChatIcon value to 3 + Set-ItemProperty -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\Windows Chat" -Name "ChatIcon" -Value 3 -Type DWord -Force + $status = Get-ChatWidgetStatus + $status | Should -Be "Disabled" + # Remove the ChatIcon value + Remove-ItemProperty -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\Windows Chat" -Name "ChatIcon" -Force } +} - Context "When -AllUsers switch is used without -EnableChatWidget, -DisableChatWidget, or -UnsetChatWidget" { - It "Should not throw an error" { - { Get-ChatWidgetStatus -AllUsers } | Should -Not -Throw - } +Context "When -AllUsers switch is used without -EnableChatWidget, -DisableChatWidget, or -UnsetChatWidget" { + It "Should not throw an error" { + { Get-ChatWidgetStatus -AllUsers } | Should -Not -Throw } +} - Context "When -AllUsers switch is used with -EnableChatWidget" { - It "Should set the Chat widget status for all users" { - Set-ChatWidgetStatus -EnableChatWidget -AllUsers - $status = Get-ChatWidgetStatus -AllUsers - $status | Should -Be "Enabled" - # Disable the Chat widget for all users - Set-ChatWidgetStatus -DisableChatWidget -AllUsers - } +Context "When -AllUsers switch is used with -EnableChatWidget" { + It "Should set the Chat widget status for all users" { + Set-ChatWidgetStatus -EnableChatWidget -AllUsers + $status = Get-ChatWidgetStatus -AllUsers + $status | Should -Be "Enabled" + # Disable the Chat widget for all users + Set-ChatWidgetStatus -DisableChatWidget -AllUsers } +} - Context "When -AllUsers switch is used with -DisableChatWidget" { - It "Should set the Chat widget status for all users" { - Set-ChatWidgetStatus -DisableChatWidget -AllUsers - $status = Get-ChatWidgetStatus -AllUsers - $status | Should -Be "Disabled" - # Enable the Chat widget for all users - Set-ChatWidgetStatus -EnableChatWidget -AllUsers - } +Context "When -AllUsers switch is used with -DisableChatWidget" { + It "Should set the Chat widget status for all users" { + Set-ChatWidgetStatus -DisableChatWidget -AllUsers + $status = Get-ChatWidgetStatus -AllUsers + $status | Should -Be "Disabled" + # Enable the Chat widget for all users + Set-ChatWidgetStatus -EnableChatWidget -AllUsers } +} - Context "When -AllUsers switch is used with -UnsetChatWidget" { - It "Should set the Chat widget status for all users" { - Set-ChatWidgetStatus -UnsetChatWidget -AllUsers - $status = Get-ChatWidgetStatus -AllUsers - $status | Should -Be "Not Set" - } +Context "When -AllUsers switch is used with -UnsetChatWidget" { + It "Should set the Chat widget status for all users" { + Set-ChatWidgetStatus -UnsetChatWidget -AllUsers + $status = Get-ChatWidgetStatus -AllUsers + $status | Should -Be "Not Set" } } +} Describe "Set-ChatWidgetStatus Function" { Context "When -EnableChatWidget switch is used" {