1 Commits

Author SHA1 Message Date
Hsiao-nan Cheung
851e100d15 fix(test): Fix 'cache_path' test in Linux
Signed-off-by: Hsiao-nan Cheung <niheaven@gmail.com>
2025-03-06 00:19:57 +08:00

View File

@@ -243,14 +243,14 @@ Describe 'cache_path' -Tag 'Scoop' {
$ret = cache_path 'git' '2.44.0' $url
$inputStream = [System.IO.MemoryStream]::new([System.Text.Encoding]::UTF8.GetBytes($url))
$sha = (Get-FileHash -Algorithm SHA256 -InputStream $inputStream).Hash.ToLower().Substring(0, 7)
$ret | Should -Be "$cachedir\git#2.44.0#$sha.zip"
$ret | Should -Be (Join-Path $cachedir "git#2.44.0#$sha.zip")
}
# # NOTE: Remove this 6 months after the feature ships.
It 'returns the old format cache path for a given input' {
Mock Test-Path { $true }
$ret = cache_path 'git' '2.44.0' 'https://example.com/git.zip'
$ret | Should -Be "$cachedir\git#2.44.0#https_example.com_git.zip"
$ret | Should -Be (Join-Path $cachedir 'git#2.44.0#https_example.com_git.zip')
}
}