Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Tests/Convert-PDFToText.Tests.ps1
Original file line number Diff line number Diff line change
@@ -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'
}
Expand Down
14 changes: 8 additions & 6 deletions Tests/Set-PDFForm.Tests.ps1
Original file line number Diff line number Diff line change
@@ -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' {
Expand Down Expand Up @@ -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
}
}
}
}
Loading