forked from ScoopInstaller/Extras
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Scoop-Bucket.Tests.ps1
42 lines (38 loc) · 1.51 KB
/
Scoop-Bucket.Tests.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
. "$env:scoop_home\test\Scoop-TestLib.ps1"
. "$env:scoop_home\lib\core.ps1"
. "$env:scoop_home\lib\manifest.ps1"
describe "manifest-validation" {
beforeall {
$working_dir = setup_working "manifest"
$schema = "$env:scoop_home\schema.json"
Add-Type -Path "$env:scoop_home\supporting\validator\Newtonsoft.Json.dll"
Add-Type -Path "$env:scoop_home\supporting\validator\Newtonsoft.Json.Schema.dll"
Add-Type -Path "$env:scoop_home\supporting\validator\Scoop.Validator.dll"
}
it "Scoop.Validator is available" {
([System.Management.Automation.PSTypeName]'Scoop.Validator').Type | should be 'Scoop.Validator'
}
context "manifest validates against the schema" {
beforeall {
$bucketdir = "$psscriptroot"
$manifest_files = gci $bucketdir *.json
$validator = new-object Scoop.Validator($schema, $true)
}
$manifest_files | % {
it "$_" {
$validator.Validate($_.fullname)
if ($validator.Errors.Count -gt 0) {
write-host -f yellow $validator.ErrorsAsString
}
$validator.Errors.Count | should be 0
$manifest = parse_json $_.fullname
$url = arch_specific "url" $manifest "32bit"
$url64 = arch_specific "url" $manifest "64bit"
if(!$url) {
$url = $url64
}
$url | should not benullorempty
}
}
}
}