Last active
March 10, 2022 02:40
-
-
Save jdhitsolutions/ca59721d1c58ec6940a96248b8226ec1 to your computer and use it in GitHub Desktop.
A fun Pester test for testing days of the week.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#requires -version 5.0 | |
<# | |
Weekly.tests.ps1 | |
a Pester test for the week | |
Usage: Invoke-Pester .\Weekly.tests.ps1 | |
#> | |
Describe Monday { | |
It "Came much too soon." { | |
$true | Should be True | |
} | |
It "Has too many meetings." { | |
Start-Sleep -Seconds 10 | |
$true | Should be True | |
} | |
It "Should run without error." { | |
$r = Get-Random -Maximum 10 -Minimum 1 | |
{ if ($r%2 -as [boolean]) { | |
throw "Too many help desk calls" | |
} } | Should Not Throw | |
} | |
} | |
Describe Tuesday { | |
It "Isn't Monday. Yay!" { | |
$true | Should be True | |
} | |
It "Doesn't have as many meetings." { | |
Start-Sleep -Seconds 10 | |
$true | Should be True | |
} | |
} | |
Describe Wednesday { | |
It "Is hump day." { | |
$true | Should be True | |
} | |
It "Means real work is finally getting done." { | |
$true | Should be True | |
} | |
} | |
Describe Thursday { | |
It "Would be better if it was Friday." { | |
$true | Should be True | |
} | |
} | |
Describe Friday { | |
It "Took way too long to get here." { | |
$true | Should be True | |
} | |
It "I'll probably have to work late." { | |
$true | Should be True | |
} | |
It "TGIF is better than TGIM." { | |
1 -gt 0 | Should be True | |
} | |
} | |
Describe Saturday { | |
It "Will involve beer and/or bourbon." { | |
$true | Should Be True | |
} | |
It "Should not mean getting called into work." { | |
$r = Get-Random -Maximum 10 -Minimum 1 | |
$r%2 -as [boolean] | Should Be $True | |
} | |
} | |
Describe Sunday { | |
$now = Get-Date | |
$f = 1,2,10,11,12 | |
$b = 5,6,7,8,9 | |
if ($f -contains $now.month) { | |
$act = "watching football" | |
} | |
elseif ($b -contains $now.month) { | |
$act = "watching baseball" | |
} | |
else { | |
$act = "household chores" | |
} | |
It "Might mean $act." { | |
$true | Should be True | |
} | |
It "Means no late night because tomorrow is a work day." { | |
$true | Should be True | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment