mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-06 00:23:20 +00:00
Update Pester Syntax from V3 to V4 (V5 won't support the old version)
This commit is contained in:
@@ -17,25 +17,25 @@ Describe 'ConvertFrom-ExcelSheet / Export-ExcelSheet' {
|
||||
}
|
||||
Context "Exporting to CSV" {
|
||||
it "Exported the expected columns to a CSV file " {
|
||||
$firstText[0] | should be '"Race","Date","FinishPosition","Driver","GridPosition","Team","Points"'
|
||||
$SecondText[0] | should be '"Race","Date","FinishPosition","Driver","GridPosition","Team","Points"'
|
||||
$ThirdText[0] | should be '"Driver","date","FinishPosition","GridPosition"'
|
||||
$FourthText[0] | should be '"Race","Date","FinishPosition","Driver","GridPosition","Team","Points"'
|
||||
$firstText[0] | Should -Be '"Race","Date","FinishPosition","Driver","GridPosition","Team","Points"'
|
||||
$SecondText[0] | Should -Be '"Race","Date","FinishPosition","Driver","GridPosition","Team","Points"'
|
||||
$ThirdText[0] | Should -Be '"Driver","date","FinishPosition","GridPosition"'
|
||||
$FourthText[0] | Should -Be '"Race","Date","FinishPosition","Driver","GridPosition","Team","Points"'
|
||||
}
|
||||
it "Applied AsText, AsDate and Properties correctly " {
|
||||
$firstText[1] | should match '^"\w+","\d{5}","\d{1,2}","\w+ \w+","[1-9]\d?","\w+","\d{1,2}"$'
|
||||
$firstText[1] | Should -Match '^"\w+","\d{5}","\d{1,2}","\w+ \w+","[1-9]\d?","\w+","\d{1,2}"$'
|
||||
$date = $firstText[1] -replace '^.*(\d{5}).*$', '$1'
|
||||
$date = [datetime]::FromOADate($date).toString("D")
|
||||
$secondText[1] | should belike "*$date*"
|
||||
$secondText[1] | should match '"0\d","\w+","\d{1,2}"$'
|
||||
$ThirdText[1] | should match '^"\w+ \w+","#\d\d/\d\d/\d{4}#","\d","0\d"$'
|
||||
$FourthText[1] | should match '^"\w+","[012]\d'
|
||||
$secondText[1] | Should -Belike "*$date*"
|
||||
$secondText[1] | Should -Match '"0\d","\w+","\d{1,2}"$'
|
||||
$ThirdText[1] | Should -Match '^"\w+ \w+","#\d\d/\d\d/\d{4}#","\d","0\d"$'
|
||||
$FourthText[1] | Should -Match '^"\w+","[012]\d'
|
||||
}
|
||||
}
|
||||
Context "Export aliased to ConvertFrom" {
|
||||
it "Definded the alias name with " {
|
||||
(Get-Alias Export-ExcelSheet).source | should be "ImportExcel"
|
||||
(Get-Alias Export-ExcelSheet).Definition | should be "ConvertFrom-ExcelSheet"
|
||||
(Get-Alias Export-ExcelSheet).source | Should -Be "ImportExcel"
|
||||
(Get-Alias Export-ExcelSheet).Definition | Should -Be "ConvertFrom-ExcelSheet"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user