mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-06 00:23:20 +00:00
Fixes to tests to be run x-plaform
This commit is contained in:
@@ -1,38 +1,38 @@
|
||||
Describe "Test reading relative paths" {
|
||||
BeforeAll {
|
||||
$script:xlfileName = "TestR.xlsx"
|
||||
@{data = 1 } | Export-Excel "$pwd\TestR.xlsx"
|
||||
@{data = 1 } | Export-Excel (Join-Path $PWD "TestR.xlsx")
|
||||
}
|
||||
|
||||
AfterAll {
|
||||
Remove-Item "$pwd\$($script:xlfileName)"
|
||||
Remove-Item (Join-Path $PWD "$($script:xlfileName)")
|
||||
}
|
||||
|
||||
It "Should read local file" {
|
||||
It "Should read local file".PadRight(90) {
|
||||
$actual = Import-Excel -Path ".\$($script:xlfileName)"
|
||||
$actual | Should Not Be $null
|
||||
$actual.Count | Should Be 1
|
||||
}
|
||||
|
||||
It "Should read with pwd" {
|
||||
$actual = Import-Excel -Path "$pwd\$($script:xlfileName)"
|
||||
It "Should read with pwd".PadRight(90){
|
||||
$actual = Import-Excel -Path (Join-Path $PWD "$($script:xlfileName)")
|
||||
$actual | Should Not Be $null
|
||||
}
|
||||
|
||||
It "Should read with just a file name and resolve to cwd" {
|
||||
It "Should read with just a file name and resolve to cwd".PadRight(90){
|
||||
$actual = Import-Excel -Path "$($script:xlfileName)"
|
||||
$actual | Should Not Be $null
|
||||
}
|
||||
|
||||
It "Should fail for not found" {
|
||||
It "Should fail for not found".PadRight(90){
|
||||
{ Import-Excel -Path "ExcelFileDoesNotExist.xlsx" } | Should Throw "'ExcelFileDoesNotExist.xlsx' file not found"
|
||||
}
|
||||
|
||||
It "Should fail for xls extension" {
|
||||
It "Should fail for xls extension".PadRight(90){
|
||||
{ Import-Excel -Path "ExcelFileDoesNotExist.xls" } | Should Throw "Import-Excel does not support reading this extension type .xls"
|
||||
}
|
||||
|
||||
It "Should fail for xlsxs extension" {
|
||||
It "Should fail for xlsxs extension".PadRight(90){
|
||||
{ Import-Excel -Path "ExcelFileDoesNotExist.xlsxs" } | Should Throw "Import-Excel does not support reading this extension type .xlsxs"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user