|
| 1 | +describe OP { |
| 2 | + it 'Is a module for open packages' { |
| 3 | + $emptyPackage = Get-OpenPackage |
| 4 | + $emptyPackage -is [IO.Packaging.Package] |
| 5 | + } |
| 6 | + it 'Can pack itself' { |
| 7 | + $PackSelf = Get-Module OP | Get-OpenPackage |
| 8 | + $PackSelf -is [IO.Packaging.Package] |
| 9 | + } |
| 10 | + it 'Can make a package from a dictionary' { |
| 11 | + $Message = "<h1>Hello World</h1>" |
| 12 | + $packDictionary = OP @{ |
| 13 | + "index.html" = $Message |
| 14 | + } |
| 15 | + $packDictionary.Count | Should -Be 1 |
| 16 | + $packDictionary.GetParts().Read() | Should -Be $Message |
| 17 | + } |
| 18 | + it 'Can make a package from an at uri' { |
| 19 | + $atProfile = op at://mrpowershell.com/app.bsky.actor.profile |
| 20 | + $atProfile.FileList | Should -Match 'app\.bsky\.actor\.profile' |
| 21 | + $atProfile.GetParts().Read().value.'$type' | Should -Be 'app.bsky.actor.profile' |
| 22 | + } |
| 23 | + it 'Can make a package from a url' { |
| 24 | + $svgPack = op https://MrPowerShell.com/MrPowerShell.svg -First 1 |
| 25 | + $svgPack.Count | Should -Be 1 |
| 26 | + $svgPack.FileList | Should -Be '/MrPowerShell.svg' |
| 27 | + } |
| 28 | + it 'Can download a nuget package' { |
| 29 | + $nugetPackage = op https://www.nuget.org/packages/System.IO.Packaging |
| 30 | + $nugetPackage.nuspec.Package.metadata.id | Should -Be System.IO.Packaging |
| 31 | + } |
| 32 | + it 'Can download part of a repository' { |
| 33 | + $iTermPalettes = |
| 34 | + op 'https://github.com/mbadolato/iTerm2-Color-Schemes/blob/master/windowsterminal/' -Force |
| 35 | + |
| 36 | + $iTermPalettes.GetParts().Read().foreground | |
| 37 | + Should -Match '^#[0-9a-f]{6}' |
| 38 | + |
| 39 | + $iTermPalettes | |
| 40 | + Set-OpenPackage -Uri '/CREDITS.md' -ContentType text/markdown -Content ( |
| 41 | + Invoke-RestMethod https://raw.githubusercontent.com/mbadolato/iTerm2-Color-Schemes/refs/heads/master/CREDITS.md |
| 42 | + ) |
| 43 | + } |
| 44 | +} |
0 commit comments