OP.tests.ps1
|
describe OP { it 'Is a module for open packages' { $emptyPackage = Get-OpenPackage $emptyPackage -is [IO.Packaging.Package] } it 'Can pack itself' { $PackSelf = Get-Module OP | Get-OpenPackage $PackSelf -is [IO.Packaging.Package] } it 'Can make a package from a dictionary' { $Message = "<h1>Hello World</h1>" $packDictionary = OP @{ "index.html" = $Message } $packDictionary.Count | Should -Be 1 $packDictionary.GetParts().Read() | Should -Be $Message } it 'Can make a package from an at uri' { $atProfile = op at://mrpowershell.com/app.bsky.actor.profile $atProfile.FileList | Should -Match 'app\.bsky\.actor\.profile' $atProfile.GetParts().Read().value.'$type' | Should -Be 'app.bsky.actor.profile' } it 'Can make a package from a url' { $svgPack = op https://MrPowerShell.com/MrPowerShell.svg -First 1 $svgPack.Count | Should -Be 1 $svgPack.FileList | Should -Be '/MrPowerShell.svg' } it 'Can download a nuget package' { $nugetPackage = op https://www.nuget.org/packages/System.IO.Packaging $nugetPackage.nuspec.Package.metadata.id | Should -Be System.IO.Packaging } it 'Can download part of a repository' { $iTermPalettes = op 'https://github.com/mbadolato/iTerm2-Color-Schemes/blob/master/windowsterminal/' -Force $iTermPalettes.GetParts().Read().foreground | Should -Match '^#[0-9a-f]{6}' $iTermPalettes | Set-OpenPackage -Uri '/CREDITS.md' -ContentType text/markdown -Content ( Invoke-RestMethod https://raw.githubusercontent.com/mbadolato/iTerm2-Color-Schemes/refs/heads/master/CREDITS.md ) } } |