mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 04:36:39 +00:00
Pester test formatting cleanups
This commit is contained in:
1 parent
7673c4e90f
commit
de6a452f63
10 files changed
+15
-16
No files matched your search
@@ -13,7 +13,6 @@ Describe "Export-Alias" {
|
||||
It "Should be able to create a file in the specified location"{
|
||||
Export-Alias $fulltestpath
|
||||
|
||||
|
||||
Test-Path $fulltestpath | Should be $true
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
}
|
||||
|
||||
It "Should be able to use the format flag" {
|
||||
# You would think that one could use simple loops here, but apparently powershell in windows returns different values in loops
|
||||
# You would think that one could use simple loops here, but apparently powershell in Windows returns different values in loops
|
||||
|
||||
(Get-Date -Format d).Contains("/") | Should be $true
|
||||
(Get-Date -Format D).Contains(",") | Should be $true
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Describe "Get-Event" {
|
||||
|
||||
BeforeEach {
|
||||
( New-Event -SourceIdentifier PesterTestEvent -sender windows.timer -messagedata "PesterTestMessage" )
|
||||
( New-Event -SourceIdentifier PesterTestEvent -sender Windows.timer -messagedata "PesterTestMessage" )
|
||||
}
|
||||
|
||||
AfterEach {
|
||||
@@ -25,8 +25,8 @@ Describe "Get-Event" {
|
||||
{ (Get-Event -SourceIdentifier PesterTimer).MessageData | Should Be "PesterTestMessage" }
|
||||
}
|
||||
|
||||
It "Should return Sender as windows.timer" {
|
||||
{ (Get-Event -SourceIdentifier PesterTimer).Sender | Should be windows.timer }
|
||||
It "Should return Sender as Windows.timer" {
|
||||
{ (Get-Event -SourceIdentifier PesterTimer).Sender | Should be Windows.timer }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Get-FileHash" {
|
||||
Describe "Get-FileHash" {
|
||||
New-Variable testDocument -Value (Join-Path -Path (Join-Path -Path $PSScriptRoot -ChildPath assets) -ChildPath testablescript.ps1) -Scope Global -Force
|
||||
# The MACTripleDES and RIPEMD160 algorithms are unsupported on Linux
|
||||
$algorithms = @{"SHA1" ="01B865D143E07ECC875AB0EFC0A4429387FD0CF7";
|
||||
@@ -41,7 +41,7 @@
|
||||
$algorithmResult.Hash | Should Be $algorithms[$algorithm]
|
||||
}
|
||||
|
||||
#MACTripleDES and RIPEMD160 are unsupported in the existing Pester tests from windows team
|
||||
#MACTripleDES and RIPEMD160 are unsupported in the existing Pester tests from Windows team
|
||||
{ Get-FileHash $testDocument -Algorithm MACTripleDES } | Should Throw "Algorithm 'MACTripleDES' is not supported in this system."
|
||||
{ Get-FileHash $testDocument -Algorithm RIPEMD160 } | Should Throw "Algorithm 'RIPEMD160' is not supported in this system."
|
||||
}
|
||||
|
||||
@@ -9,14 +9,14 @@ Describe "New-Event" {
|
||||
|
||||
Context "Check New-Event can register an event"{
|
||||
It "Should return PesterTestMessage as the MessageData" {
|
||||
(New-Event -sourceidentifier PesterTimer -sender windows.timer -messagedata "PesterTestMessage")
|
||||
(New-Event -sourceidentifier PesterTimer -sender Windows.timer -messagedata "PesterTestMessage")
|
||||
(Get-Event -SourceIdentifier PesterTimer).MessageData | Should Be "PesterTestMessage"
|
||||
Remove-Event -sourceidentifier PesterTimer
|
||||
}
|
||||
|
||||
It "Should return Sender as windows.timer" {
|
||||
(New-Event -sourceidentifier PesterTimer -sender windows.timer -messagedata "PesterTestMessage")
|
||||
(Get-Event -SourceIdentifier PesterTimer).Sender | Should be windows.timer
|
||||
It "Should return Sender as Windows.timer" {
|
||||
(New-Event -sourceidentifier PesterTimer -sender Windows.timer -messagedata "PesterTestMessage")
|
||||
(Get-Event -SourceIdentifier PesterTimer).Sender | Should be Windows.timer
|
||||
Remove-Event -sourceIdentifier PesterTimer
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ Describe "New-Item" {
|
||||
}
|
||||
|
||||
It "Should not create a file when the Name switch is not used and only a directory specified" {
|
||||
#errorAction used because permissions issue in windows
|
||||
#errorAction used because permissions issue in Windows
|
||||
New-Item -Path $tmpDirectory -ItemType file -ErrorAction SilentlyContinue
|
||||
|
||||
Test-Path $FullyQualifiedFile | Should Be $false
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Describe "Remove-Event" {
|
||||
|
||||
BeforeEach {
|
||||
New-Event -sourceidentifier PesterTimer -sender windows.timer -messagedata "PesterTestMessage"
|
||||
New-Event -sourceidentifier PesterTimer -sender Windows.timer -messagedata "PesterTestMessage"
|
||||
}
|
||||
|
||||
AfterEach {
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
$output = $in | Format-List -Property Description | Out-String
|
||||
|
||||
# This will cause errors running these tests in windows
|
||||
# This will cause errors running these tests in Windows
|
||||
$output | Should Be "${nl}${nl}Description : test description${nl}${nl}${nl}${nl}"
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
Split-Path ${qualifier}usr/bin -Qualifier | Should Be "$qualifier"
|
||||
}
|
||||
|
||||
It "Should error when using the qualifier switch for a windows path while on a nonwindows machine" {
|
||||
It "Should error when using the qualifier switch for a Windows path while on a non-Windows machine" {
|
||||
# ErrorAction SilentlyContinue merely suppresses the error from the console.
|
||||
# Throwing exceptions still seen by Pester.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Describe "Test-Path" {
|
||||
Describe "Test-Path" {
|
||||
BeforeAll {
|
||||
$testdirectory = $TestDrive
|
||||
$testfilename = New-Item -path $testdirectory -Name testfile.txt -ItemType file -Value 1 -force
|
||||
|
||||
Reference in new issue
Block a user