diff --git a/Tests/Convert-PDFToText.Tests.ps1 b/Tests/Convert-PDFToText.Tests.ps1 index 097749d..4c95c51 100644 --- a/Tests/Convert-PDFToText.Tests.ps1 +++ b/Tests/Convert-PDFToText.Tests.ps1 @@ -1,8 +1,8 @@ Describe 'Convert-PDFToText' { It 'returns objects with PageNumber and Text' { - $file = Join-Path $PSScriptRoot 'Input' 'SampleAcroForm.pdf' + $file = [IO.Path]::Combine($PSScriptRoot, 'Input', 'SampleAcroForm.pdf') $text = Convert-PDFToText -FilePath $file - $text | Should -AllBeOfType [pscustomobject] + $text | ForEach-Object { $_ | Should -BeOfType [psobject] } $text[0].PageNumber | Should -Be 1 $text[0].Text | Should -Match 'Text 1' } diff --git a/Tests/Set-PDFForm.Tests.ps1 b/Tests/Set-PDFForm.Tests.ps1 index d63a81c..23d0181 100644 --- a/Tests/Set-PDFForm.Tests.ps1 +++ b/Tests/Set-PDFForm.Tests.ps1 @@ -1,6 +1,6 @@ Describe 'Set-PDFForm' -Tags "PDFForm" { BeforeAll { - New-Item -Path $PSScriptRoot -Force -ItemType Directory -Name 'Output' + New-Item -Path $PSScriptRoot -Force -ItemType Directory -Name 'Output' | Out-Null } It 'Set-PDForm Flatten should flatten forms' { @@ -115,10 +115,12 @@ Describe 'Set-PDFForm' -Tags "PDFForm" { Close-PDF -Document $PDF } - # cleanup - $FolderPath = [IO.Path]::Combine("$PSScriptRoot", "Output") - $Files = Get-ChildItem -LiteralPath $FolderPath -File - foreach ($_ in $Files) { - Remove-Item -LiteralPath $_.FullName -ErrorAction SilentlyContinue + AfterAll { + $FolderPath = [IO.Path]::Combine("$PSScriptRoot", "Output") + if (Test-Path $FolderPath) { + Get-ChildItem -LiteralPath $FolderPath -File | ForEach-Object { + Remove-Item -LiteralPath $_.FullName -ErrorAction SilentlyContinue + } + } } }