mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
Restructure of pester test layout
This restructuring moves tests to a directory name which matches the module in which the cmdlet resides which should improve the discoverability of a specific test. For tests which are not about cmdlets in a module, new directories have been created to make those tests easier to find as well
This commit is contained in:
1 parent
ef32e2339e
commit
1e1c4b7dc0
126 files changed
+10
-6
No files matched your search
@@ -0,0 +1,41 @@
|
||||
Describe "Export-FormatData DRT Unit Tests" -Tags DRT{
|
||||
It "Test basic functionality" {
|
||||
$fd = Get-FormatData
|
||||
$tempFile = Join-Path $TestDrive -ChildPath "exportFormatTest.txt"
|
||||
$results = Export-FormatData -InputObject $fd[0] -Path $tempFile
|
||||
$content = Get-Content $tempFile
|
||||
$formatViewDefinition = $fd[0].FormatViewDefinition
|
||||
$typeName = $fd[0].TypeName
|
||||
$content.Contains($typeName) | Should Be $true
|
||||
for ($i = 0; $i -lt $formatViewDefinition.Count;$i++)
|
||||
{
|
||||
$content.Contains($formatViewDefinition[$i].Name) | Should Be $true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Export-FormatData" {
|
||||
|
||||
Context "Check Export-FormatData can be called validly." {
|
||||
It "Should be able to be called without error" {
|
||||
{ Get-FormatData | Export-FormatData -Path "outputfile" } | Should Not Throw
|
||||
Remove-Item "outputfile" -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
|
||||
Context "Check that the output is in the correct format" {
|
||||
It "Should not return an empty xml file" {
|
||||
Get-FormatData | Export-FormatData -Path "outputfile"
|
||||
$piped = Get-Content "outputfile"
|
||||
$piped | Should Not Be ""
|
||||
Remove-Item "outputfile" -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
It "Should have a valid xml tag at the start of the file" {
|
||||
Get-FormatData | Export-FormatData -Path "outputfile"
|
||||
$piped = Get-Content "outputfile"
|
||||
$piped[0] | Should Be "<"
|
||||
Remove-Item "outputfile" -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user