11BeforeAll {
22 # Import the module - adjust path as needed for your module structure
3- $ModulePath = (Resolve-Path " $PSScriptRoot \..\..\Release\PowerShell.dll " ).Path
3+ $ModulePath = (Resolve-Path " $PSScriptRoot \..\..\Release\ExcelFast.psd1 " ).Path
44 Import-Module $ModulePath - Force
55
66 # Test file paths
@@ -15,7 +15,7 @@ BeforeAll {
1515Describe ' Import-Excel Command Tests' {
1616 Context ' When importing a valid Excel file' {
1717 It ' Should successfully import data from Test10.xlsx' {
18- $actual = Import-ExcelFast - Path $ValidExcelFile
18+ $actual = Import-Workbook - Path $ValidExcelFile
1919
2020 $actual | Should -Not - BeNullOrEmpty
2121 $actual.Count | Should - Be 10
@@ -28,35 +28,35 @@ Describe 'Import-Excel Command Tests' {
2828
2929 Context ' Path Parameter' {
3030 It ' Should Error for a non-existent file path' {
31- { Import-ExcelFast - Path $InvalidPath - ErrorAction Stop } |
31+ { Import-Workbook - Path $InvalidPath - ErrorAction Stop } |
3232 Should - Throw - ExpectedMessage ' *Excel file not found*'
3333 }
3434
3535 It ' Should Error for a non-Excel extension' {
36- { Import-ExcelFast - Path $NonExcelExtension - ErrorAction Stop } |
36+ { Import-Workbook - Path $NonExcelExtension - ErrorAction Stop } |
3737 Should - Throw - ExpectedMessage ' Unsupported file type*'
3838 }
3939
4040 It ' Should Error for a non-Excel content' {
41- { Import-ExcelFast - Path $NonExcelContent - ErrorAction Stop } |
41+ { Import-Workbook - Path $NonExcelContent - ErrorAction Stop } |
4242 Should - Throw - ExpectedMessage ' * is not a valid Excel file.'
4343 }
4444
4545 It ' Should Error for a non-Excel zip file' {
46- { Import-ExcelFast - Path $NonExcelZip - ErrorAction Stop } |
46+ { Import-Workbook - Path $NonExcelZip - ErrorAction Stop } |
4747 Should - Throw - ExpectedMessage ' Sequence contains no elements*'
4848 }
4949 }
5050
5151 Context ' When specifying sheet names' {
5252 It " Should throw an error when sheet doesn't exist" {
5353
54- { Import-ExcelFast - Path $ValidExcelFile - SheetName ' NonExistentSheet' - ErrorAction Stop } |
54+ { Import-Workbook - Path $ValidExcelFile - SheetName ' NonExistentSheet' - ErrorAction Stop } |
5555 Should - Throw - ExpectedMessage " *Sheet 'NonExistentSheet' does not exist*"
5656 }
5757
5858 It ' Should import data when specifying Sheet1' {
59- $actual = Import-ExcelFast - Path $ValidExcelFile - SheetName ' Sheet1'
59+ $actual = Import-Workbook - Path $ValidExcelFile - SheetName ' Sheet1'
6060
6161 $actual | Should -Not - BeNullOrEmpty
6262 $actual.Count | Should - Be 10
@@ -70,7 +70,7 @@ Describe 'Import-Excel Command Tests' {
7070 Context ' When importing multiple files' {
7171 It ' Should process an array of file paths' {
7272 # Use the same file twice for this test
73- $actual = Import-ExcelFast - Path @ ($ValidExcelFile , $ValidExcelFile )
73+ $actual = Import-Workbook - Path @ ($ValidExcelFile , $ValidExcelFile )
7474
7575 # Should have twice as many results as we're reading the same file twice
7676 $actual | Should -Not - BeNullOrEmpty
0 commit comments