-
-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathClear-PSBuildOutputFolder.tests.ps1
More file actions
28 lines (21 loc) · 1001 Bytes
/
Clear-PSBuildOutputFolder.tests.ps1
File metadata and controls
28 lines (21 loc) · 1001 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Describe 'Clear-PSBuildOutputFolder' {
BeforeAll {
$script:moduleName = 'PowerShellBuild'
$script:moduleRoot = Split-Path -Path $PSScriptRoot -Parent
Import-Module ([IO.Path]::Combine($script:moduleRoot, 'Output', $script:moduleName)) -Force
}
It 'removes the target folder when it exists' {
$path = Join-Path -Path $TestDrive -ChildPath 'OutputFolder'
New-Item -Path $path -ItemType Directory -Force | Out-Null
New-Item -Path (Join-Path -Path $path -ChildPath 'artifact.txt') -ItemType File -Force | Out-Null
Clear-PSBuildOutputFolder -Path $path
$path | Should -Not -Exist
}
It 'does not throw when the target folder does not exist' {
$path = Join-Path -Path $TestDrive -ChildPath 'MissingFolder'
{ Clear-PSBuildOutputFolder -Path $path } | Should -Not -Throw
}
It 'rejects paths with 3 or fewer characters' {
{ Clear-PSBuildOutputFolder -Path 'abc' } | Should -Throw
}
}