Skip to content

Commit

Permalink
final unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisTitusTech committed Jan 12, 2024
1 parent 353ce7b commit 2a58eda
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 24 deletions.
24 changes: 23 additions & 1 deletion pester/functions.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,35 @@
# Tests - Functions
#===========================================================================

# Get all .ps1 files in the functions folder
$ps1Files = Get-ChildItem -Path ./functions -Filter *.ps1

# Loop through each file
foreach ($file in $ps1Files) {
# Define the test name
$testName = "Syntax check for $($file.Name)"

# Define the test script
$testScript = {
# Import the script
. $file.FullName

# Check if any errors occurred
$scriptError = $error[0]
$scriptError | Should -Be $null
}

# Add the test to the Pester test suite
Describe $testName $testScript
}

Describe "Functions"{

Get-ChildItem .\functions -Recurse -File | ForEach-Object {

context "$($psitem.BaseName)" {
BeforeEach -Scriptblock {
. $fullname
. $psitem.FullName
}

It "Imports with no errors" -TestCases @{
Expand Down
23 changes: 0 additions & 23 deletions pester/winutil.Tests.ps1

This file was deleted.

0 comments on commit 2a58eda

Please sign in to comment.