Skip to content

Commit

Permalink
Fix (tests): Fix some unit tests to use Pester v4 syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
leojonathanoh committed Jul 18, 2021
1 parent 440a796 commit fb63662
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Get-DuplicateItem/public/Get-DuplicateItem.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@ Describe "Get-DuplicateItem" -Tag 'Unit' {
It 'Shows error when Path does not exist' {
Get-DuplicateItem -Path $invalidPath -ErrorVariable err -ErrorAction Continue 2>$null

$err.Count | Should Not Be 0
$err.Count | Should -Not -Be 0
}

It 'Shows error when LiteralPath does not exist' {
Get-DuplicateItem -LiteralPath $invalidPath -ErrorVariable err -ErrorAction Continue 2>$null

$err.Count | Should Not Be 0
$err.Count | Should -Not -Be 0
}

It 'Shows error when pipeline object is not a string' {
$invalidPathCollection = @( @( "foo", "bar") )
$invalidPathCollection | Get-DuplicateItem -ErrorVariable err -ErrorAction Continue 2>$null

$err.Count | Should Not Be 0
$err.Count | Should -Not -Be 0
}

It 'Shows error when pipeline object is not an existing Path' {
$invalidPath | Get-DuplicateItem -ErrorVariable err -ErrorAction Continue 2>$null

$err.Count | Should Not Be 0
$err.Count | Should -Not -Be 0
}

}
Expand Down Expand Up @@ -66,26 +66,26 @@ Describe "Get-DuplicateItem" -Tag 'Unit' {
It 'Remains silent when Path does not exist' {
$err = Get-DuplicateItem -Path $invalidPath -ErrorVariable err -ErrorAction SilentlyContinue

$err | Should Be $null
$err | Should -Be $null
}

It 'Remains silent when LiteralPath does not exist' {
$err = Get-DuplicateItem -Path $invalidPath -ErrorVariable err -ErrorAction SilentlyContinue

$err | Should Be $null
$err | Should -Be $null
}

It 'Remains silent when pipeline object is not a string' {
$invalidPathCollection = @( @( "foo", "bar") )
$err = $invalidPathCollection | Get-DuplicateItem -ErrorVariable err -ErrorAction SilentlyContinue

$err | Should Be $null
$err | Should -Be $null
}

It 'Remains silent when pipeline object is not an existing Path' {
$err = $invalidPath | Get-DuplicateItem -ErrorVariable err -ErrorAction SilentlyContinue

$err | Should Be $null
$err | Should -Be $null
}

}
Expand Down

0 comments on commit fb63662

Please sign in to comment.