Migrates to Pester5+ tests #59

Merged
OCram85 merged 47 commits from Pester5 into master 2022-07-14 13:37:13 +02:00
Showing only changes of commit f90741d82a - Show all commits

View File

@ -13,8 +13,15 @@ BeforeAll {
Describe "Resolve-Dependency" { Describe "Resolve-Dependency" {
Context "Basic syntax check" { Context "Basic syntax check" {
Mock Get-ModuleBase { return (Join-Path -Path $PWD -ChildPath '/resources') } -ModuleName 'PSCredentialStore' BeforeAll {
Mock Test-Module { return $true } -ModuleName 'PSCredentialStore' Mock -ModuleName 'PSCredentialStore' Get-ModuleBase {
return (Join-Path -Path $PWD -ChildPath '/resources')
}
Mock -ModuleName 'PSCredentialStore' Test-Module {
return $true
}
}
It "Test1: Should not throw" { It "Test1: Should not throw" {
{ Resolve-Dependency -Name 'foobar2000' } | Should -Not -Throw { Resolve-Dependency -Name 'foobar2000' } | Should -Not -Throw
} }
@ -37,11 +44,16 @@ Describe "Resolve-Dependency" {
} }
} }
Context "Testing input variations" { Context "Testing input variations" {
Mock Get-ModuleBase { return (Join-Path -Path $PWD -ChildPath '/resources') } -ModuleName 'PSCredentialStore'
It "Should return true if all given dependencies exist" { It "Should return true if all given dependencies exist" {
Mock Get-ModuleBase {
return (Join-Path -Path $PWD -ChildPath '/resources')
}
Resolve-Dependency -Name 'Existing' | Should -Be $true Resolve-Dependency -Name 'Existing' | Should -Be $true
} }
It "Mixed results should return false" { It "Mixed results should return false" {
Mock Get-ModuleBase {
return (Join-Path -Path $PWD -ChildPath '/resources')
}
Resolve-Dependency -Name 'PSGetMixed' | Should -Be $false Resolve-Dependency -Name 'PSGetMixed' | Should -Be $false
} }
} }