mirror of
https://github.com/lukaszraczylo/gohoarder.git
synced 2026-11-25 06:35:21 +00:00
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.
21 lines
686 B
Go
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")
|
|
}
|
|
}
|