From 17d82ad06251ab4989af3ede79aec2c67475cdf2 Mon Sep 17 00:00:00 2001 From: Zachary Folwick Date: Tue, 6 Oct 2015 12:04:57 -0700 Subject: [PATCH] Added Format-Wide Pester tests --- src/pester-tests/Test-Format-Wide.Tests.ps1 | 40 +++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/pester-tests/Test-Format-Wide.Tests.ps1 diff --git a/src/pester-tests/Test-Format-Wide.Tests.ps1 b/src/pester-tests/Test-Format-Wide.Tests.ps1 new file mode 100644 index 000000000..7dc159746 --- /dev/null +++ b/src/pester-tests/Test-Format-Wide.Tests.ps1 @@ -0,0 +1,40 @@ +Describe "Test-Format-Wide" { + It "Should be able to call format wide without error" { + { Get-Process | Format-Wide } | Should Not Throw + } + + It "Should be able to use the fw alias without error" { + { Get-Process | fw } | Should Not Throw + } + + It "Should have the same output between the alias and the unaliased function" { + $nonaliased = Get-ChildItem | Format-Wide + $aliased = Get-ChildItem | fw + + $($nonaliased | Out-String).CompareTo($($aliased | Out-String)) | Should Be 0 + } + + It "Should be able to specify the columns in output using the column switch" { + { ls | Format-Wide -Column 3 } | Should Not Throw + } + + It "Should be able to use the autosize switch" { + { ls | Format-Wide -Autosize } | Should Not Throw + } + + It "Should be able to take inputobject instead of pipe" { + { Format-Wide -InputObject $(ls) } | Should Not Throw + } + + It "Should be able to use the property switch" { + { Format-Wide -InputObject $(ls) -Property Mode } | Should Not Throw + } + + It "Should throw an error when property switch and view switch are used together" { + { Format-Wide -InputObject $(ls) -Property CreationTime -View aoeu } | Should Throw "Found invalid data" + } + + It "Should throw and suggest proper input when view is used with invalid input without the property switch" { + { Format-Wide -InputObject $(gps) -View aoeu } | Should Throw + } +}