mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-06 00:23:20 +00:00
First test
This commit is contained in:
26
__tests__/Remove-WorkSheet.tests.ps1
Normal file
26
__tests__/Remove-WorkSheet.tests.ps1
Normal file
@@ -0,0 +1,26 @@
|
||||
#Requires -Modules Pester
|
||||
Import-Module $PSScriptRoot\..\ImportExcel.psd1 -Force
|
||||
|
||||
Describe "Remove Worksheet" {
|
||||
Context "Remove a worksheet output" {
|
||||
BeforeAll {
|
||||
# Create three sheets
|
||||
$data = ConvertFrom-Csv @"
|
||||
"@
|
||||
$xlFile = "$env:TEMP\RemoveWorsheet.xlsx"
|
||||
Remove-Item $xlFile -ErrorAction SilentlyContinue
|
||||
|
||||
$data | Export-Excel -Path $xlFile -WorksheetName Target1
|
||||
$data | Export-Excel -Path $xlFile -WorksheetName Target2
|
||||
$data | Export-Excel -Path $xlFile -WorksheetName Target3
|
||||
}
|
||||
|
||||
it "Should delete Target2" {
|
||||
Remove-WorkSheet -Path $xlFile -WorksheetName Target2
|
||||
|
||||
$actual = (Get-ExcelSheetInfo -Path $xlFile).count
|
||||
|
||||
$actual | Should Be 2
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user