Migrates to Pester5+ tests #59
@ -1,3 +1,16 @@
|
||||
BeforeAll {
|
||||
$ManifestFile = (Get-Item -Path "./src/*.psd1").FullName
|
||||
Import-Module $ManifestFile -Force
|
||||
|
||||
$PrivateFunctions = (Get-ChildItem -Path "./src/Private/*.ps1" | Where-Object {
|
||||
$_.BaseName -notmatch '.Tests'
|
||||
}
|
||||
).FullName
|
||||
foreach ( $func in $PrivateFunctions) {
|
||||
. $func
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Get-DefaultCredentialStorePath" {
|
||||
Context "Basic syntax test" {
|
||||
It "Test1: Should not throw" {
|
20
src/Private/Get-ModuleBase.Tests.ps1
Normal file
20
src/Private/Get-ModuleBase.Tests.ps1
Normal file
@ -0,0 +1,20 @@
|
||||
BeforeAll {
|
||||
$ManifestFile = (Get-Item -Path "./src/*.psd1").FullName
|
||||
Import-Module $ManifestFile -Force
|
||||
|
||||
$PrivateFunctions = (Get-ChildItem -Path "./src/Private/*.ps1" | Where-Object {
|
||||
$_.BaseName -notmatch '.Tests'
|
||||
}
|
||||
).FullName
|
||||
foreach ( $func in $PrivateFunctions) {
|
||||
. $func
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Get-ModuleBase" {
|
||||
Context "Basic syntax check" {
|
||||
It "Test1: Should not throw" {
|
||||
{ Get-ModuleBase } | Should -Not -Throw
|
||||
}
|
||||
}
|
||||
}
|
26
src/Private/Get-RandomAESKey.Tests.ps1
Normal file
26
src/Private/Get-RandomAESKey.Tests.ps1
Normal file
@ -0,0 +1,26 @@
|
||||
BeforeAll {
|
||||
$ManifestFile = (Get-Item -Path "./src/*.psd1").FullName
|
||||
Import-Module $ManifestFile -Force
|
||||
|
||||
$PrivateFunctions = (Get-ChildItem -Path "./src/Private/*.ps1" | Where-Object {
|
||||
$_.BaseName -notmatch '.Tests'
|
||||
}
|
||||
).FullName
|
||||
foreach ( $func in $PrivateFunctions) {
|
||||
. $func
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Get-RandomKey" {
|
||||
Context "Basic input tests" {
|
||||
It "Test1: Should not throw " {
|
||||
{ Get-RandomAESKey } | Should -Not -Throw
|
||||
}
|
||||
}
|
||||
Context "Basic syntax check" {
|
||||
It "Test2: Should return a key with a length of 32 bytes" {
|
||||
$Key = Get-RandomAESKey
|
||||
$Key.length | Should -Be 32
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +1,16 @@
|
||||
BeforeAll {
|
||||
$ManifestFile = (Get-Item -Path "./src/*.psd1").FullName
|
||||
Import-Module $ManifestFile -Force
|
||||
|
||||
$PrivateFunctions = (Get-ChildItem -Path "./src/Private/*.ps1" | Where-Object {
|
||||
$_.BaseName -notmatch '.Tests'
|
||||
}
|
||||
).FullName
|
||||
foreach ( $func in $PrivateFunctions) {
|
||||
. $func
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Get-TempDir" {
|
||||
Context "Basic tests" {
|
||||
It "Should not throw" {
|
||||
@ -17,7 +30,11 @@ Describe "Get-TempDir" {
|
||||
}
|
||||
}
|
||||
if ($Env:APPVEYOR) {
|
||||
if (($isWindows) -or ($PSVersionTable.PSVersion.Major -lt 6) -or ($PSVersionTable.PSEdition -eq 'Desktop')) {
|
||||
if (
|
||||
($isWindows) -or
|
||||
($PSVersionTable.PSVersion.Major -lt 6) -or
|
||||
($PSVersionTable.PSEdition -eq 'Desktop')
|
||||
) {
|
||||
$RefPath = (Resolve-Path -Path $env:TEMP).Path
|
||||
$Path | Should -Be $RefPath
|
||||
}
|
@ -1,3 +1,16 @@
|
||||
BeforeAll {
|
||||
$ManifestFile = (Get-Item -Path "./src/*.psd1").FullName
|
||||
Import-Module $ManifestFile -Force
|
||||
|
||||
$PrivateFunctions = (Get-ChildItem -Path "./src/Private/*.ps1" | Where-Object {
|
||||
$_.BaseName -notmatch '.Tests'
|
||||
}
|
||||
).FullName
|
||||
foreach ( $func in $PrivateFunctions) {
|
||||
. $func
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Resolve-Dependency" {
|
||||
Context "Basic syntax check" {
|
||||
Mock Get-ModuleBase { return (Join-Path -Path $PWD -ChildPath '/resources') }
|
@ -1,3 +1,16 @@
|
||||
BeforeAll {
|
||||
$ManifestFile = (Get-Item -Path "./src/*.psd1").FullName
|
||||
Import-Module $ManifestFile -Force
|
||||
|
||||
$PrivateFunctions = (Get-ChildItem -Path "./src/Private/*.ps1" | Where-Object {
|
||||
$_.BaseName -notmatch '.Tests'
|
||||
}
|
||||
).FullName
|
||||
foreach ( $func in $PrivateFunctions) {
|
||||
. $func
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Test-ModuleName" {
|
||||
Context "Basic input tests" {
|
||||
It "Testing standard module should not throw" {
|
@ -1,7 +0,0 @@
|
||||
Describe "Get-ModuleBase" {
|
||||
Context "Basic syntax check" {
|
||||
It "Test1: Should not throw" {
|
||||
{ Get-ModuleBase } | Should -Not -Throw
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
Describe "Get-RandomKey" {
|
||||
Context "Basic input tests" {
|
||||
It "Test1: Should not throw " {
|
||||
{Get-RandomAESKey} | Should -Not -Throw
|
||||
}
|
||||
}
|
||||
Context "Basic syntax check" {
|
||||
It "Test2: Should return a key with a length of 32 bytes" {
|
||||
$Key = Get-RandomAESKey
|
||||
$Key.length | Should -Be 32
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user