chore: publish IntegraCI build modules a11ec75d3e09
This commit is contained in:
1 parent
694710104a
commit
3c2b80914e
78 files changed
+4982
-405
No files matched your search
@@ -0,0 +1,25 @@
|
||||
package main
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestParseLicencesListsPackagesWithoutDeciding(t *testing.T) {
|
||||
report := `{"Results":[{"Licenses":[
|
||||
{"PkgName":"left-pad","Name":"MIT"},
|
||||
{"PkgName":"left-pad","Name":"MIT"},
|
||||
{"PkgName":"gpl-thing","Name":"GPL-3.0"},
|
||||
{"PkgName":"","Name":"Apache-2.0"}]}]}`
|
||||
got, err := parseLicences(report)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
want := []PackageLicence{{"gpl-thing", "GPL-3.0"}, {"left-pad", "MIT"}}
|
||||
if len(got) != len(want) || got[0] != want[0] || got[1] != want[1] {
|
||||
t.Fatalf("got %v, want %v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAnUnreadableLicenceReportIsAnError(t *testing.T) {
|
||||
if _, err := parseLicences("FATAL"); err == nil {
|
||||
t.Fatal("an unreadable report must be could_not_run, not an empty list")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user