forked from ScoopInstaller/Scoop
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(Manifest): Support bucket lookup in Resolve (#137)
- Loading branch information
Showing
2 changed files
with
206 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -175,6 +175,122 @@ Describe 'Manifests operations' -Tag 'Scoop' { | |
} | ||
} | ||
|
||
Describe 'Get-ManifestFromLookup' { | ||
It 'Simple lookup' { | ||
$result = Resolve-ManifestInformation 'pwsh' | ||
$result.ApplicationName | Should -Be 'pwsh' | ||
$result.Version | Should -Be '7.1.3' | ||
$result.ManifestObject.bin | Should -Be 'pwsh.exe' | ||
$result.Bucket | Should -Be 'ash258.ash258' | ||
$result = $null | ||
|
||
$result = Resolve-ManifestInformation 'cosi' | ||
$result.ApplicationName | Should -Be 'cosi' | ||
$result.Version | Should -Be '7.1.3' | ||
$result.ManifestObject.checkver | Should -Be 'github' | ||
$result = $null | ||
} | ||
|
||
It 'Simple versioned lookup' { | ||
$result = Resolve-ManifestInformation '[email protected]' | ||
$result.ApplicationName | Should -Be 'pwsh' | ||
$result.Version | Should -Be '6.2.3' | ||
$result.ManifestObject.bin | Should -Be 'pwsh.exe' | ||
$result = $null | ||
|
||
$result = Resolve-ManifestInformation '[email protected]' | ||
$result.ApplicationName | Should -Be 'cosi' | ||
$result.Bucket | Should -Be 'ash258.ash258' | ||
$result.Version | Should -Be '7.1.0' | ||
$result.ManifestObject.homepage | Should -Be 'https://github.com/PowerShell/PowerShell' | ||
$result = $null | ||
|
||
{ Resolve-ManifestInformation 'tryharder' } | Should -Throw 'No manifest found for ''tryharder''' | ||
} | ||
|
||
It 'Specific bucket lookup' { | ||
$result = Resolve-ManifestInformation 'main/pwsh' | ||
$result.ApplicationName | Should -Be 'pwsh' | ||
$result.Version | Should -Be '7.1.3' | ||
$result.ManifestObject.bin | Should -Be 'pwsh.exe' | ||
$result.Bucket | Should -Be 'main' | ||
$result = $null | ||
|
||
$result = Resolve-ManifestInformation 'ash258.ash258/cosi' | ||
$result.ApplicationName | Should -Be 'cosi' | ||
$result.Bucket | Should -Be 'ash258.ash258' | ||
$result.Version | Should -Be '7.1.3' | ||
$result.ManifestObject.checkver | Should -Be 'github' | ||
$result = $null | ||
|
||
{ Resolve-ManifestInformation 'nonexistent/cosi' } | Should -Throw '''nonexistent'' cannot be found' | ||
{ Resolve-ManifestInformation 'main/tryharder' } | Should -Throw 'No manifest found for ''main/tryharder''' | ||
} | ||
|
||
It 'Specific bucket lookup with existing versioned manifest' { | ||
$result = Resolve-ManifestInformation 'ash258.ash258/[email protected]' | ||
$result.ApplicationName | Should -Be 'pwsh' | ||
$result.Version | Should -Be '6.2.3' | ||
$result.ManifestObject.bin | Should -Be 'pwsh.exe' | ||
$result.Bucket | Should -Be 'ash258.ash258' | ||
$result = $null | ||
|
||
$result = Resolve-ManifestInformation 'main/[email protected]' | ||
$result.ApplicationName | Should -Be 'cosi' | ||
$result.Bucket | Should -Be 'main' | ||
$result.Version | Should -Be '7.1.0' | ||
$result.ManifestObject.homepage | Should -Be 'https://github.com/PowerShell/PowerShell' | ||
$result = $null | ||
|
||
{ Resolve-ManifestInformation 'main/[email protected]' 6>$null } | Should -Throw 'Cannot generate manifest with version ''6.8.0''' | ||
{ Resolve-ManifestInformation 'ash258.ash258/cosi@8' 6>$null } | Should -Throw 'Cannot generate manifest with version ''8''' | ||
} | ||
|
||
It 'Simple lookup with version generation' { | ||
$result = Resolve-ManifestInformation '[email protected]' 6>$null | ||
$result.ApplicationName | Should -Be 'pwsh' | ||
$result.Version | Should -Be '7.0.6' | ||
$result.Bucket | Should -Be 'ash258.ash258' | ||
$result.LocalPath.Extension | Should -BeLike '.json' | ||
$result.LocalPath.BaseName | Should -BeLike 'pwsh-258258--*' | ||
$result.LocalPath.Directory.BaseName | Should -BeLike 'manifests' | ||
$result.ManifestObject.bin | Should -Be 'pwsh.exe' | ||
$result = $null | ||
|
||
$result = Resolve-ManifestInformation '[email protected]' 6>$null | ||
$result.ApplicationName | Should -Be 'cosi' | ||
$result.Bucket | Should -Be 'ash258.ash258' | ||
$result.LocalPath.Extension | Should -BeLike '.yaml' | ||
$result.LocalPath.BaseName | Should -BeLike 'cosi-258258--*' | ||
$result.LocalPath.Directory.BaseName | Should -BeLike 'manifests' | ||
$result.Version | Should -Be '6.2.3' | ||
$result.ManifestObject.homepage | Should -Be 'https://github.com/PowerShell/PowerShell' | ||
$result = $null | ||
} | ||
|
||
It 'Specific bucket lookup with version generation' { | ||
$result = Resolve-ManifestInformation 'main/[email protected]' 6>$null | ||
$result.ApplicationName | Should -Be 'pwsh' | ||
$result.Version | Should -Be '7.0.6' | ||
$result.Bucket | Should -Be 'main' | ||
$result.LocalPath.Extension | Should -BeLike '.json' | ||
$result.LocalPath.BaseName | Should -BeLike 'pwsh-258258--*' | ||
$result.LocalPath.Directory.BaseName | Should -BeLike 'manifests' | ||
$result.ManifestObject.bin | Should -Be 'pwsh.exe' | ||
$result = $null | ||
|
||
$result = Resolve-ManifestInformation 'ash258.ash258/[email protected]' 6>$null | ||
$result.ApplicationName | Should -Be 'pwsh' | ||
$result.Bucket | Should -Be 'ash258.ash258' | ||
$result.LocalPath.Extension | Should -BeLike '.json' | ||
$result.LocalPath.BaseName | Should -BeLike 'pwsh-258258--*' | ||
$result.LocalPath.Directory.BaseName | Should -BeLike 'manifests' | ||
$result.Version | Should -Be '7.0.6' | ||
$result.ManifestObject.homepage | Should -Be 'https://github.com/PowerShell/PowerShell' | ||
$result = $null | ||
} | ||
} | ||
|
||
It 'Not supported query' { | ||
{ Resolve-ManifestInformation '@@cosi@@' } | Should -Throw 'Not supported way how to provide manifest' | ||
{ Resolve-ManifestInformation '@1.2.5.8' } | Should -Throw 'Not supported way how to provide manifest' | ||
|