Files
gohoarder/pkg/app/package_summary_test.go
T
lukaszraczylo 947b264d94 fix(pypi): send the release version in the scanned package list
The package list builds its own payload when scanning is on, and that payload left out release_version, so the dashboard still showed file names. A helper now builds the summary and a test covers it.
2026-11-23 02:47:34 +00:00

21 lines
686 B
Go

package app
import (
"testing"
"github.com/lukaszraczylo/gohoarder/pkg/metadata"
)
func TestPackageSummaryCarriesReleaseVersion(t *testing.T) {
withRelease := packageSummary(&metadata.Package{Name: "six", Version: "six-1.17.0.tar.gz", ReleaseVersion: "1.17.0"})
if got := withRelease["release_version"]; got != "1.17.0" {
t.Errorf("release_version = %v, want 1.17.0", got)
}
if got := withRelease["version"]; got != "six-1.17.0.tar.gz" {
t.Errorf("version = %v, want the cache key", got)
}
if _, ok := packageSummary(&metadata.Package{Name: "left-pad", Version: "1.3.0"})["release_version"]; ok {
t.Error("a row without a release version must not send the field")
}
}