Skip to content

Commit d40e1a8

Browse files
committed
update test
1 parent aff95e5 commit d40e1a8

1 file changed

Lines changed: 8 additions & 20 deletions

File tree

test/PublishPSResourceTests/CompressPSResource.Tests.ps1

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -400,19 +400,13 @@ Describe "Test Compress-PSResource" -tags 'CI' {
400400
$version = "1.0.0"
401401
New-ModuleManifest -Path (Join-Path -Path $script:PublishModuleBase -ChildPath "$script:PublishModuleName.psd1") -ModuleVersion $version -Description "$script:PublishModuleName module"
402402

403-
# Create Public and Private directories with .gitkeep files
404-
$publicDir = Join-Path -Path $script:PublishModuleBase -ChildPath "Public"
405-
$privateDir = Join-Path -Path $script:PublishModuleBase -ChildPath "Private"
406-
New-Item -Path $publicDir -ItemType Directory -Force
407-
New-Item -Path $privateDir -ItemType Directory -Force
403+
# Create 'hidden' directory with .gitkeep files
404+
$hiddenDir = Join-Path -Path $script:PublishModuleBase -ChildPath "hidden"
405+
New-Item -Path $hiddenDir -ItemType Directory -Force
408406

409-
# Create empty .gitkeep in Public
410-
$publicGitkeep = Join-Path -Path $publicDir -ChildPath ".gitkeep"
411-
New-Item -Path $publicGitkeep -ItemType File -Force
412-
413-
# Create non-empty .gitkeep in Private
414-
$privateGitkeep = Join-Path -Path $privateDir -ChildPath ".gitkeep"
415-
"# Keep this directory" | Out-File -FilePath $privateGitkeep -Force
407+
# Create empty .gitkeep file in 'hidden' directory
408+
$hiddenGitkeep = Join-Path -Path $hiddenDir -ChildPath ".gitkeep"
409+
New-Item -Path $hiddenGitkeep -ItemType File -Force
416410

417411
Compress-PSResource -Path $script:PublishModuleBase -DestinationPath $script:repositoryPath
418412

@@ -425,15 +419,9 @@ Describe "Test Compress-PSResource" -tags 'CI' {
425419
Expand-Archive -Path $zipPath -DestinationPath $unzippedPath
426420

427421
# Verify both .gitkeep files exist
428-
$extractedPublicGitkeep = Join-Path -Path $unzippedPath -ChildPath "Public" | Join-Path -ChildPath ".gitkeep"
429-
$extractedPrivateGitkeep = Join-Path -Path $unzippedPath -ChildPath "Private" | Join-Path -ChildPath ".gitkeep"
430-
431-
Test-Path -Path $extractedPublicGitkeep | Should -Be $True
432-
Test-Path -Path $extractedPrivateGitkeep | Should -Be $True
422+
$extractedHiddenkeep = Join-Path -Path $unzippedPath -ChildPath "hidden" | Join-Path -ChildPath ".gitkeep"
433423

434-
# Verify empty file is still empty and non-empty has content
435-
(Get-Item $extractedPublicGitkeep).Length | Should -Be 0
436-
(Get-Item $extractedPrivateGitkeep).Length | Should -BeGreaterThan 0
424+
Test-Path -Path $extractedHiddenkeep | Should -Be $True
437425

438426
$null = Remove-Item $unzippedPath -Force -Recurse
439427
}

0 commit comments

Comments
 (0)