Refactor Installer and Host Tests to Pester 4 Syntax#6283
Refactor Installer and Host Tests to Pester 4 Syntax#6283iSazonov wants to merge 9 commits intoPowerShell:masterfrom
Conversation
| } | ||
|
|
||
| It "-File should be able to pass bool string values as string to parameters: <BoolString>" -TestCases @( | ||
| It "-File Should -Be able to pass bool string values as string to parameters: <BoolString>" -TestCases @( |
There was a problem hiding this comment.
It seems this was unintentional
| } | ||
|
|
||
| It "-File should be able to pass bool string values as string to positional parameters: <BoolString>" -TestCases @( | ||
| It "-File Should -Be able to pass bool string values as string to positional parameters: <BoolString>" -TestCases @( |
There was a problem hiding this comment.
It seems this was unintentional
| } | ||
|
|
||
| It "-File should be able to pass bool string values as bool to switches: <BoolString>" -TestCases @( | ||
| It "-File Should -Be able to pass bool string values as bool to switches: <BoolString>" -TestCases @( |
There was a problem hiding this comment.
It seems this was unintentional
| # ensure the setting was written to the settings file. | ||
| $content = (Get-Content -Path $CustomSettingsFile | ConvertFrom-Json) | ||
| $content.'Microsoft.PowerShell:ExecutionPolicy' | Should Be $expectedValue | ||
| $content.'Microsoft.PowerShell:ExecutionPolicy' | Should -Be $expectedValue |
There was a problem hiding this comment.
This should be -BeExactly
| # ensure the setting is applied on next run | ||
| $actualValue = & $powershell -NoProfile -SettingsFile $CustomSettingsFile -Command {(Get-ExecutionPolicy -Scope LocalMachine).ToString()} | ||
| $actualValue | Should Be $expectedValue | ||
| $actualValue | Should -Be $expectedValue |
There was a problem hiding this comment.
This should be -BeExactly
| $result.CompletionMatches[0].CompletionText | Should Be $DatetimeProperties[0].Name # Date | ||
| $result.CompletionMatches[1].CompletionText | Should Be $DatetimeProperties[1].Name # DateTime | ||
| $result.CompletionMatches.Count | Should -Be $DatetimeProperties.Count | ||
| $result.CompletionMatches[0].CompletionText | Should -Be $DatetimeProperties[0].Name # Date |
| $result.CompletionMatches[1].CompletionText | Should Be $DatetimeProperties[1].Name # DateTime | ||
| $result.CompletionMatches.Count | Should -Be $DatetimeProperties.Count | ||
| $result.CompletionMatches[0].CompletionText | Should -Be $DatetimeProperties[0].Name # Date | ||
| $result.CompletionMatches[1].CompletionText | Should -Be $DatetimeProperties[1].Name # DateTime |
| } | ||
|
|
||
| $result | Should Not Be $null | ||
| $result | Should -Not -Be $null |
There was a problem hiding this comment.
Should be -Not -BeNullOrEmpty
There was a problem hiding this comment.
@markekraus Can you confirm using -BeNullOrEmpty?
| $result.CompletionMatches.Count | Should -Be 3 | ||
| $result.CompletionMatches[0].CompletionText | Should -Be 'Expression' | ||
| $result.CompletionMatches[1].CompletionText | Should -Be 'Ascending' | ||
| $result.CompletionMatches[2].CompletionText | Should -Be 'Descending' |
There was a problem hiding this comment.
Similar to above comments.
| It 'Should complete Command' { | ||
| $res = TabExpansion2 -inputScript 'Get-Com' -cursorColumn 'Get-Com'.Length | ||
| $res.CompletionMatches[0].CompletionText | Should be Get-Command | ||
| $res.CompletionMatches[0].CompletionText | Should -Be Get-Command |
There was a problem hiding this comment.
All Shoulds comparing string must be -BeExactly
There was a problem hiding this comment.
I believe we shouldn't mess syntax changes and the functional changes - our tests have tons gaps like this - this huge job needs to be done in other PRs.
|
Done in #6250 |
PR Summary
Related #6245
Changes from Should Be syntax to Should -Be syntax.
One commit per file.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.[feature]if the change is significant or affects feature tests