From 64a242c1d3fcd89dbdcd36593110f2492f7bc3b5 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Thu, 8 Mar 2018 11:04:58 +0100 Subject: [PATCH] add refs for pester test --- tests/00_BasicModule.Tests.ps1 | 15 +++++++++++++++ ....Tests.ps1 => 01_Resolve-Dependency.Tests.ps1} | 5 +++-- ...s.ps1 => 02_New-CredentialStoreItem.Tests.ps1} | 0 ...Tests.ps1 => 01_Get-CredentialStore.Tests.ps1} | 0 ...Tests.ps1 => 01_New-CredentialStore.Tests.ps1} | 0 ...ests.ps1 => 01_Test-CredentialStore.Tests.ps1} | 0 6 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 tests/00_BasicModule.Tests.ps1 rename tests/Helper/{01_Resolve-Dependendy.Tests.ps1 => 01_Resolve-Dependency.Tests.ps1} (84%) rename tests/Item/{01_New-CredentialStoreItem.Tests.ps1 => 02_New-CredentialStoreItem.Tests.ps1} (100%) rename tests/Store/{00_Get-CredentialStore.Tests.ps1 => 01_Get-CredentialStore.Tests.ps1} (100%) rename tests/Store/{00_New-CredentialStore.Tests.ps1 => 01_New-CredentialStore.Tests.ps1} (100%) rename tests/Store/{00_Test-CredentialStore.Tests.ps1 => 01_Test-CredentialStore.Tests.ps1} (100%) diff --git a/tests/00_BasicModule.Tests.ps1 b/tests/00_BasicModule.Tests.ps1 new file mode 100644 index 0000000..7e8dfe9 --- /dev/null +++ b/tests/00_BasicModule.Tests.ps1 @@ -0,0 +1,15 @@ +$RepoRoot = (Get-GitDirectory).replace('\.git', '') + +Describe "Pre-Flight module tests" { + $ManifestFilePath = "{0}\src\PSCredentialstore.psd1" -f $RepoRoot + Context "Manifest file related" { + It "Test the parsed file itsef" { + { Test-ModuleManifest -Path $ManifestFilePath } | Should -Not -Throw + } + } + Context "Module consistency tests" { + IT "Importing should work" { + { Import-Module -Name $ManifestFilePath -Global } | Should -Not -Throw + } + } +} diff --git a/tests/Helper/01_Resolve-Dependendy.Tests.ps1 b/tests/Helper/01_Resolve-Dependency.Tests.ps1 similarity index 84% rename from tests/Helper/01_Resolve-Dependendy.Tests.ps1 rename to tests/Helper/01_Resolve-Dependency.Tests.ps1 index 013c65b..9c6e54d 100644 --- a/tests/Helper/01_Resolve-Dependendy.Tests.ps1 +++ b/tests/Helper/01_Resolve-Dependency.Tests.ps1 @@ -14,7 +14,8 @@ Else { } # load additional functions defined in the repository. Replace the expression . -#. (Get-ChildItem -Path $RepoRoot -Filter ".ps1" -Recurse).FullName +. (Get-ChildItem -Path $RepoRoot -Filter "Get-ModuleBase.ps1" -Recurse).FullName +. (Get-ChildItem -Path $RepoRoot -Filter "Test-Module.ps1" -Recurse).FullName #endregion HEADER Describe "Resolve-Dependency" { @@ -25,7 +26,7 @@ Describe "Resolve-Dependency" { { Resolve-Dependency -Name 'foobar2000' } | Should -Not -Throw } It "Test2: Output type should be bool" { - Resolve-Dependency -Name 'foobar2000' | Should -BeOfType system.bool + Resolve-Dependency -Name 'foobar2000' | Should -BeOfType bool } } } diff --git a/tests/Item/01_New-CredentialStoreItem.Tests.ps1 b/tests/Item/02_New-CredentialStoreItem.Tests.ps1 similarity index 100% rename from tests/Item/01_New-CredentialStoreItem.Tests.ps1 rename to tests/Item/02_New-CredentialStoreItem.Tests.ps1 diff --git a/tests/Store/00_Get-CredentialStore.Tests.ps1 b/tests/Store/01_Get-CredentialStore.Tests.ps1 similarity index 100% rename from tests/Store/00_Get-CredentialStore.Tests.ps1 rename to tests/Store/01_Get-CredentialStore.Tests.ps1 diff --git a/tests/Store/00_New-CredentialStore.Tests.ps1 b/tests/Store/01_New-CredentialStore.Tests.ps1 similarity index 100% rename from tests/Store/00_New-CredentialStore.Tests.ps1 rename to tests/Store/01_New-CredentialStore.Tests.ps1 diff --git a/tests/Store/00_Test-CredentialStore.Tests.ps1 b/tests/Store/01_Test-CredentialStore.Tests.ps1 similarity index 100% rename from tests/Store/00_Test-CredentialStore.Tests.ps1 rename to tests/Store/01_Test-CredentialStore.Tests.ps1