diff --git a/ghsa/ghsa.go b/ghsa/ghsa.go index 2785dab..b87eda0 100644 --- a/ghsa/ghsa.go +++ b/ghsa/ghsa.go @@ -378,7 +378,7 @@ func ghsaToOSVEcosystem(ghsaEco string) string { case ecoPub: return "Pub" case ecoSwift: - return "SwiftPM" + return "SwiftURL" default: return ghsaEco } diff --git a/ghsa/ghsa_test.go b/ghsa/ghsa_test.go new file mode 100644 index 0000000..bef31d1 --- /dev/null +++ b/ghsa/ghsa_test.go @@ -0,0 +1,25 @@ +package ghsa + +import "testing" + +func TestGHSAToOSVEcosystem(t *testing.T) { + tests := []struct { + name string + ecosystem string + want string + }{ + { + name: "swift uses the OSV schema ecosystem name", + ecosystem: ecoSwift, + want: "SwiftURL", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := ghsaToOSVEcosystem(tt.ecosystem); got != tt.want { + t.Errorf("ghsaToOSVEcosystem(%q) = %q, want %q", tt.ecosystem, got, tt.want) + } + }) + } +}