-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Refactor Installer and Host Tests to Pester 4 Syntax #6283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be -BeExactly
| $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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be -BeExactly
| } | ||
|
|
||
| $result | Should Not Be $null | ||
| $result | Should -Not -Be $null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be -Not -BeNullOrEmpty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All Shoulds comparing string must be -BeExactly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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