|
1 | | -############################################################################### |
2 | 1 | Pester\Describe 'Find-Item 1' { |
3 | 2 |
|
4 | | - Pester\It 'Should work with wildcard in the holding directory' { |
5 | | - |
6 | | - $pattern = Expand-Path "$PSScriptRoot\..\..\..\..\Genx*\1*\functions\genxdev.*\*.ps1" |
7 | | - |
8 | | - $found = @(GenXdev.FileSystem\Find-Item -SearchMask $pattern) |
9 | | - |
10 | | - if ($found.Count -eq 0) { |
11 | | - Write-Warning 'Find-Item still not working, see issue' |
12 | | - } |
13 | | - else { |
14 | | - Write-Host 'Find-Item is FIXED!!' -ForegroundColor Cyan |
15 | | - } |
16 | | - |
17 | | - # $found.Count | Pester\Should -GT 0 |
18 | | - } |
19 | | - |
20 | | - Pester\It 'Should pass PSScriptAnalyzer rules' { |
21 | | - |
22 | | - # get the script path for analysis |
23 | | - $scriptPath = GenXdev.FileSystem\Expand-Path "$PSScriptRoot\..\..\Functions\GenXdev.FileSystem\Find-Item.ps1" |
24 | | - |
25 | | - # run analyzer with explicit settings |
26 | | - $analyzerResults = GenXdev.Coding\Invoke-GenXdevScriptAnalyzer ` |
27 | | - -Path $scriptPath |
28 | | - |
29 | | - [string] $message = '' |
30 | | - $analyzerResults | Microsoft.PowerShell.Core\ForEach-Object { |
31 | | - |
32 | | - $message = $message + @" |
33 | | --------------------------------------------------- |
34 | | -Rule: $($_.RuleName)` |
35 | | -Description: $($_.Description) |
36 | | -Message: $($_.Message) |
37 | | -`r`n |
38 | | -"@ |
39 | | - } |
40 | | - |
41 | | - $analyzerResults.Count | Pester\Should -Be 0 -Because @" |
42 | | -The following PSScriptAnalyzer rules are being violated: |
43 | | -$message |
44 | | -"@; |
45 | | - } |
46 | | - |
47 | 3 | Pester\BeforeAll { |
48 | 4 | $testRoot = GenXdev.FileSystem\Expand-Path "$env:TEMP\GenXdev.FileSystem.Tests\" -CreateDirectory |
49 | 5 | $testDir = Microsoft.PowerShell.Management\Join-Path $testRoot 'find-item-tests' |
@@ -71,6 +27,22 @@ $message |
71 | 27 | GenXdev.FileSystem\Remove-AllItems $testDir |
72 | 28 | } |
73 | 29 |
|
| 30 | + Pester\It 'Should work with wildcard in the holding directory' { |
| 31 | + |
| 32 | + $pattern = Expand-Path "$PSScriptRoot\..\..\..\..\Genx*\1*\functions\genxdev.*\*.ps1" |
| 33 | + |
| 34 | + $found = @(GenXdev.FileSystem\Find-Item -SearchMask $pattern) |
| 35 | + |
| 36 | + if ($found.Count -eq 0) { |
| 37 | + Write-Warning 'Find-Item still not working, see issue' |
| 38 | + } |
| 39 | + else { |
| 40 | + Write-Host 'Find-Item is FIXED!!' -ForegroundColor Cyan |
| 41 | + } |
| 42 | + |
| 43 | + # $found.Count | Pester\Should -GT 0 |
| 44 | + } |
| 45 | + |
74 | 46 | Pester\It 'Finds files by extension' { |
75 | 47 | # setup test folder structure |
76 | 48 | $testDir = GenXdev.FileSystem\Expand-Path "$testRoot\find-item-test\" -CreateDirectory |
@@ -341,9 +313,8 @@ $message |
341 | 313 |
|
342 | 314 | Pester\It 'Should match the pattern' { |
343 | 315 |
|
344 | | - $found = @(GenXdev.FileSystem\Find-Item -SearchMask "$PSScriptRoot\..\..\..\..\..\**\Genx*stem\1.236.2025\Functions\GenXdev.FileSystem\*.ps1" -PassThru | Microsoft.PowerShell.Utility\Select-Object -ExpandProperty FullName) |
| 316 | + $found = @(GenXdev.FileSystem\Find-Item -SearchMask "$PSScriptRoot\..\..\..\..\..\**\Genx*stem\1.238.2025\Functions\GenXdev.FileSystem\*.ps1" -PassThru | Microsoft.PowerShell.Utility\Select-Object -ExpandProperty FullName) |
345 | 317 |
|
346 | | - $found | Pester\Should -Contain (GenXdev.FileSystem\Expand-Path "$PSScriptRoot\..\..\Functions\GenXdev.FileSystem\_EnsureTypes.ps1") |
347 | 318 | $found | Pester\Should -Contain (GenXdev.FileSystem\Expand-Path "$PSScriptRoot\..\..\Functions\GenXdev.FileSystem\EnsurePester.ps1") |
348 | 319 | $found | Pester\Should -Contain (GenXdev.FileSystem\Expand-Path "$PSScriptRoot\..\..\Functions\GenXdev.FileSystem\Expand-Path.ps1") |
349 | 320 | $found | Pester\Should -Contain (GenXdev.FileSystem\Expand-Path "$PSScriptRoot\..\..\Functions\GenXdev.FileSystem\Find-DuplicateFiles.ps1") |
|
0 commit comments