Skip to content

Commit

Permalink
(chocolatey#3364) Skip unusable tab completion tests
Browse files Browse the repository at this point in the history
These tests are verifying the old method and are targeting an
implementation detail, rather than actually checking the tab completion
results, which the following tests do anyway.

As such, we're best off skipping them as there is no direct way to check
the same things for the Register-ArgumentCompleter method. The tests for
the tab completion results themselves covers this adequately already.
  • Loading branch information
vexx32 committed Nov 6, 2024
1 parent 3b7baf7 commit 140b1fe
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/pester-tests/chocolateyProfile.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ Describe "Chocolatey Profile" -Tag Chocolatey, Profile, Environment {
}

Context "Tab Completion" {
It "Should Exist" {
# In PS 5+ we use Register-ArgumentCompleter, so this won't be present
It "Should Exist" -Skip:($PSVersionTable.PSVersion.Major -ge 5) {
Test-Path Function:\TabExpansion | Should -BeTrue
}

It "Should have overridden TabExpansion with a new scriptblock including ChocolateyTabExpansion" {
# In PS 5+ we use Register-ArgumentCompleter, so this won't be present
It "Should have overridden TabExpansion with a new scriptblock including ChocolateyTabExpansion" -Skip:($PSVersionTable.PSVersion.Major -ge 5) {
[bool]((Get-Command TabExpansion).ScriptBlock -match "ChocolateyTabExpansion") | Should -BeTrue
}

Expand Down

0 comments on commit 140b1fe

Please # to comment.