|
8 | 8 | # test task runner defined in .vscode\tasks.json.
|
9 | 9 |
|
10 | 10 | # This (empty) file is required by some of the tests.
|
11 |
| -$null = New-Item -Path "$PSScriptRoot\foo[1].txt" -Force |
12 | 11 |
|
13 |
| -Import-Module $PSScriptRoot\..\SampleModule.psd1 |
| 12 | +BeforeAll { |
| 13 | + $null = New-Item -Path "$PSScriptRoot\foo[1].txt" -Force |
14 | 14 |
|
15 |
| -$WorkspaceRoot = Convert-Path $PSScriptRoot/.. |
16 |
| -Set-Location $WorkspaceRoot |
| 15 | + Import-Module $PSScriptRoot\..\SampleModule.psd1 |
| 16 | + |
| 17 | + $WorkspaceRoot = Convert-Path $PSScriptRoot/.. |
| 18 | + Set-Location $WorkspaceRoot |
| 19 | +} |
17 | 20 |
|
18 | 21 | Describe 'Verify Path Processing for Non-existing Paths Allowed Impl' {
|
19 | 22 | It 'Processes non-wildcard absolute path to non-existing file via -Path param' {
|
20 |
| - New-File -Path $WorkspaceRoot\ReadmeNew.md | Should Be "$WorkspaceRoot\READMENew.md" |
| 23 | + New-File -Path $WorkspaceRoot\ReadmeNew.md | Should -Be "$WorkspaceRoot\READMENew.md" |
21 | 24 | }
|
22 | 25 | It 'Processes multiple absolute paths via -Path param' {
|
23 | 26 | New-File -Path $WorkspaceRoot\Readme.md, $WorkspaceRoot\XYZZY.ps1 |
|
24 |
| - Should Be @("$WorkspaceRoot\README.md", "$WorkspaceRoot\XYZZY.ps1") |
| 27 | + Should -Be @("$WorkspaceRoot\README.md", "$WorkspaceRoot\XYZZY.ps1") |
25 | 28 | }
|
26 | 29 | It 'Processes relative path via -Path param' {
|
27 |
| - New-File -Path ..\Examples\READMENew.md | Should Be "$WorkspaceRoot\READMENew.md" |
| 30 | + New-File -Path ..\Examples\READMENew.md | Should -Be "$WorkspaceRoot\READMENew.md" |
28 | 31 | }
|
29 | 32 | It 'Processes multiple relative path via -Path param' {
|
30 | 33 | New-File -Path ..\Examples\README.md, XYZZY.ps1 |
|
31 |
| - Should Be @("$WorkspaceRoot\README.md", "$WorkspaceRoot\XYZZY.ps1") |
| 34 | + Should -Be @("$WorkspaceRoot\README.md", "$WorkspaceRoot\XYZZY.ps1") |
32 | 35 | }
|
33 | 36 |
|
34 | 37 | It 'Should accept pipeline input to Path' {
|
35 |
| - Get-ChildItem -LiteralPath "$WorkspaceRoot\Tests\foo[1].txt" | New-File | Should Be "$PSScriptRoot\foo[1].txt" |
| 38 | + Get-ChildItem -LiteralPath "$WorkspaceRoot\Tests\foo[1].txt" | New-File | Should -Be "$PSScriptRoot\foo[1].txt" |
36 | 39 | }
|
37 | 40 | }
|
38 | 41 |
|
39 | 42 | Describe 'Verify Path Processing for NO Wildcards Allowed Impl' {
|
40 | 43 | It 'Processes non-wildcard absolute path via -Path param' {
|
41 |
| - Import-FileNoWildcard -Path $WorkspaceRoot\Readme.md | Should Be "$WorkspaceRoot\README.md" |
| 44 | + Import-FileNoWildcard -Path $WorkspaceRoot\Readme.md | Should -Be "$WorkspaceRoot\README.md" |
42 | 45 | }
|
43 | 46 | It 'Processes multiple absolute paths via -Path param' {
|
44 | 47 | Import-FileNoWildcard -Path $WorkspaceRoot\Readme.md, $WorkspaceRoot\PathProcessingWildcards.ps1 |
|
45 |
| - Should Be @("$WorkspaceRoot\README.md", "$WorkspaceRoot\PathProcessingWildcards.ps1") |
| 48 | + Should -Be @("$WorkspaceRoot\README.md", "$WorkspaceRoot\PathProcessingWildcards.ps1") |
46 | 49 | }
|
47 | 50 | It 'Processes relative path via -Path param' {
|
48 |
| - Import-FileNoWildcard -Path ..\examples\README.md | Should Be "$WorkspaceRoot\README.md" |
| 51 | + Import-FileNoWildcard -Path ..\examples\README.md | Should -Be "$WorkspaceRoot\README.md" |
49 | 52 | }
|
50 | 53 | It 'Processes multiple relative path via -Path param' {
|
51 | 54 | Import-FileNoWildcard -Path ..\examples\README.md, .vscode\launch.json |
|
52 |
| - Should Be @("$WorkspaceRoot\README.md", "$WorkspaceRoot\.vscode\launch.json") |
| 55 | + Should -Be @("$WorkspaceRoot\README.md", "$WorkspaceRoot\.vscode\launch.json") |
53 | 56 | }
|
54 | 57 |
|
55 | 58 | It 'Should accept pipeline input to Path' {
|
56 |
| - Get-ChildItem -LiteralPath "$WorkspaceRoot\Tests\foo[1].txt" | Import-FileNoWildcard | Should Be "$PSScriptRoot\foo[1].txt" |
| 59 | + Get-ChildItem -LiteralPath "$WorkspaceRoot\Tests\foo[1].txt" | Import-FileNoWildcard | Should -Be "$PSScriptRoot\foo[1].txt" |
57 | 60 | }
|
58 | 61 | }
|
59 | 62 |
|
60 | 63 | Describe 'Verify Path Processing for Wildcards Allowed Impl' {
|
61 | 64 | It 'Processes non-wildcard absolute path via -Path param' {
|
62 |
| - Import-FileWildcard -Path $WorkspaceRoot\Readme.md | Should Be "$WorkspaceRoot\README.md" |
| 65 | + Import-FileWildcard -Path $WorkspaceRoot\Readme.md | Should -Be "$WorkspaceRoot\README.md" |
63 | 66 | }
|
64 | 67 | It 'Processes multiple absolute paths via -Path param' {
|
65 | 68 | Import-FileWildcard -Path $WorkspaceRoot\Readme.md, $WorkspaceRoot\PathProcessingWildcards.ps1 |
|
66 |
| - Should Be @("$WorkspaceRoot\README.md", "$WorkspaceRoot\PathProcessingWildcards.ps1") |
| 69 | + Should -Be @("$WorkspaceRoot\README.md", "$WorkspaceRoot\PathProcessingWildcards.ps1") |
67 | 70 | }
|
68 | 71 | It 'Processes wildcard absolute path via -Path param' {
|
69 | 72 | $files = Import-FileWildcard -Path $WorkspaceRoot\*.psd1
|
70 |
| - $files.Count | Should Be 2 |
71 |
| - $files[0] | Should Be "$WorkspaceRoot\PSScriptAnalyzerSettings.psd1" |
72 |
| - $files[1] | Should Be "$WorkspaceRoot\SampleModule.psd1" |
| 73 | + $files.Count | Should -Be 2 |
| 74 | + $files[0] | Should -Be "$WorkspaceRoot\PSScriptAnalyzerSettings.psd1" |
| 75 | + $files[1] | Should -Be "$WorkspaceRoot\SampleModule.psd1" |
73 | 76 | }
|
74 | 77 | It 'Processes wildcard relative path via -Path param' {
|
75 | 78 | $files = Import-FileWildcard -Path *.psd1
|
76 |
| - $files.Count | Should Be 2 |
77 |
| - $files[0] | Should Be "$WorkspaceRoot\PSScriptAnalyzerSettings.psd1" |
78 |
| - $files[1] | Should Be "$WorkspaceRoot\SampleModule.psd1" |
| 79 | + $files.Count | Should -Be 2 |
| 80 | + $files[0] | Should -Be "$WorkspaceRoot\PSScriptAnalyzerSettings.psd1" |
| 81 | + $files[1] | Should -Be "$WorkspaceRoot\SampleModule.psd1" |
79 | 82 | }
|
80 | 83 | It 'Processes relative path via -Path param' {
|
81 |
| - Import-FileWildcard -Path ..\examples\README.md | Should Be "$WorkspaceRoot\README.md" |
| 84 | + Import-FileWildcard -Path ..\examples\README.md | Should -Be "$WorkspaceRoot\README.md" |
82 | 85 | }
|
83 | 86 | It 'Processes multiple relative path via -Path param' {
|
84 | 87 | Import-FileWildcard -Path ..\examples\README.md, .vscode\launch.json |
|
85 |
| - Should Be @("$WorkspaceRoot\README.md", "$WorkspaceRoot\.vscode\launch.json") |
| 88 | + Should -Be @("$WorkspaceRoot\README.md", "$WorkspaceRoot\.vscode\launch.json") |
86 | 89 | }
|
87 | 90 |
|
88 |
| - It 'DefaultParameterSet should be Path' { |
| 91 | + It 'DefaultParameterSet should -be Path' { |
89 | 92 | $files = Import-FileWildcard *.psd1
|
90 |
| - $files.Count | Should Be 2 |
91 |
| - $files[0] | Should Be "$WorkspaceRoot\PSScriptAnalyzerSettings.psd1" |
92 |
| - $files[1] | Should Be "$WorkspaceRoot\SampleModule.psd1" |
| 93 | + $files.Count | Should -Be 2 |
| 94 | + $files[0] | Should -Be "$WorkspaceRoot\PSScriptAnalyzerSettings.psd1" |
| 95 | + $files[1] | Should -Be "$WorkspaceRoot\SampleModule.psd1" |
93 | 96 | }
|
94 | 97 |
|
95 | 98 | It 'Should process absolute literal paths via -LiteralPath param'{
|
96 |
| - Import-FileWildcard -LiteralPath "$PSScriptRoot\foo[1].txt" | Should Be "$PSScriptRoot\foo[1].txt" |
| 99 | + Import-FileWildcard -LiteralPath "$PSScriptRoot\foo[1].txt" | Should -Be "$PSScriptRoot\foo[1].txt" |
97 | 100 | }
|
98 | 101 | It 'Should process relative literal paths via -LiteralPath param'{
|
99 |
| - Import-FileWildcard -LiteralPath "..\examples\Tests\foo[1].txt" | Should Be "$PSScriptRoot\foo[1].txt" |
| 102 | + Import-FileWildcard -LiteralPath "..\examples\Tests\foo[1].txt" | Should -Be "$PSScriptRoot\foo[1].txt" |
100 | 103 | }
|
101 | 104 | It 'Should process multiple literal paths via -LiteralPath param'{
|
102 | 105 | Import-FileWildcard -LiteralPath "..\examples\Tests\foo[1].txt", "$WorkspaceRoot\README.md" |
|
103 |
| - Should Be @("$PSScriptRoot\foo[1].txt", "$WorkspaceRoot\README.md") |
| 106 | + Should -Be @("$PSScriptRoot\foo[1].txt", "$WorkspaceRoot\README.md") |
104 | 107 | }
|
105 | 108 |
|
106 | 109 | It 'Should accept pipeline input to LiteralPath' {
|
107 |
| - Get-ChildItem -LiteralPath "$WorkspaceRoot\Tests\foo[1].txt" | Import-FileWildcard | Should Be "$PSScriptRoot\foo[1].txt" |
| 110 | + Get-ChildItem -LiteralPath "$WorkspaceRoot\Tests\foo[1].txt" | Import-FileWildcard | Should -Be "$PSScriptRoot\foo[1].txt" |
108 | 111 | }
|
109 | 112 | }
|
0 commit comments