File tree Expand file tree Collapse file tree 1 file changed +54
-0
lines changed
tests/pester-tests/features Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ Import-Module helpers/ common- helpers
2+
3+ # These tests are skipped when not in Test Kitchen as the packages for this test are not available in this repository.
4+ # These tests also modify files outside of the tests.
5+ Describe " Extraction tests <_> command" - Skip:(-not $env: TEST_KITCHEN ) - ForEach @ (
6+ ' install'
7+ ' upgrade'
8+ if (Test-PackageIsEqualOrHigher - PackageName chocolatey.extension - Version 5.0 .0 ) {
9+ ' download'
10+ }
11+ ) - Tag Extraction {
12+ BeforeDiscovery {
13+ $Type = @ (
14+ ' combined-extracted-path'
15+ ' absolute-extracted-path'
16+ ' relative-extracted-path'
17+ )
18+ }
19+
20+ BeforeAll {
21+ Initialize-ChocolateyTestInstall
22+ New-ChocolateyInstallSnapshot
23+ $Command = $_
24+ }
25+
26+ AfterAll {
27+ Remove-ChocolateyTestInstall
28+ }
29+
30+ Context ' <_> extraction' - ForEach $Type {
31+ BeforeAll {
32+ Restore-ChocolateyInstallSnapshot
33+
34+ $Output = Invoke-Choco $Command $_ -- confirm
35+ }
36+
37+ AfterAll {
38+ Remove-Item - Path C:\demonstration - Force - Recurse - ErrorAction SilentlyContinue
39+ }
40+
41+ It ' Exits correctly' {
42+ $Output.ExitCode | Should - Be 1 - Because $Output.String
43+ }
44+
45+ It ' Should output correctly' {
46+ $Output.String | Should -Match " The package '$_ .1.0.0' contains an entry '.*' which is unsafe for extraction."
47+ }
48+
49+ It ' Should not create the file.' {
50+ ' C:\demonstration\demo.txt' | Should -Not - Exist - Because $Output.String
51+ }
52+
53+ }
54+ }
You can’t perform that action at this time.
0 commit comments