Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Refactor Installer and Host Tests to Pester 4 Syntax#6283

Closed
iSazonov wants to merge 9 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
iSazonov:tests-pester4-installeriSazonov/PowerShell:tests-pester4-installerCopy head branch name to clipboard
Closed

Refactor Installer and Host Tests to Pester 4 Syntax#6283
iSazonov wants to merge 9 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
iSazonov:tests-pester4-installeriSazonov/PowerShell:tests-pester4-installerCopy head branch name to clipboard

Conversation

@iSazonov

@iSazonov iSazonov commented Mar 1, 2018

Copy link
Copy Markdown
Collaborator

PR Summary

Related #6245

Changes from Should Be syntax to Should -Be syntax.
One commit per file.

PR Checklist

}

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 @(

Copy link
Copy Markdown
Member

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 @(

Copy link
Copy Markdown
Member

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 @(

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be -Not -BeNullOrEmpty

Copy link
Copy Markdown
Collaborator Author

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'

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Collaborator Author

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.

@iSazonov

Copy link
Copy Markdown
Collaborator Author

Done in #6250

@iSazonov iSazonov closed this Mar 26, 2018
@iSazonov iSazonov deleted the tests-pester4-installer branch March 26, 2018 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.