From 9112ccfed6647758ebe6a54eb3a79311f1bde048 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 18 Aug 2024 23:06:14 +0200 Subject: [PATCH] Add tests --- tests/tests/PSModuleTest.Tests.ps1 | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/tests/tests/PSModuleTest.Tests.ps1 b/tests/tests/PSModuleTest.Tests.ps1 index 4af6182..4a28ad9 100644 --- a/tests/tests/PSModuleTest.Tests.ps1 +++ b/tests/tests/PSModuleTest.Tests.ps1 @@ -8,14 +8,25 @@ Param( Write-Verbose "Path to the module: [$Path]" -Verbose Describe 'PSModuleTest.Tests.ps1' { - It 'Should be able to import the module' { - Import-Module -name 'PSModuleTest' -Verbose - Get-Module -name 'PSModuleTest' | Should -Not -BeNullOrEmpty - Write-Verbose (Get-Module -name 'PSModuleTest' | Out-String) -Verbose + Context 'Function: Test-PSModuleTest' { + It 'Should be able to call the function' { + Write-Verbose (Test-PSModuleTest | Out-String) -Verbose + Test-PSModuleTest | Should -Be 'Hello, World!' + } + } + + Context 'Function: Get-PSModuleTest' { + It 'Should be able to call the function' { + Write-Verbose (Get-PSModuleTest | Out-String) -Verbose + Get-PSModuleTest | Should -Be 'Hello, World!' + } } - It 'Should be able to call the function' { - Test-PSModuleTest -name 'World' | Should -Be 'Hello, World!' - Write-Verbose (Test-PSModuleTest -name 'World' | Out-String) -Verbose + + Context 'Function: New-PSModuleTest' { + It 'Should be able to call the function' { + Write-Verbose (New-PSModuleTest | Out-String) -Verbose + New-PSModuleTest | Should -Be 'Hello, World!' + } } Context 'Variables' {