summaryrefslogtreecommitdiff
path: root/internal/showcase/metadata_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-11 22:40:31 +0200
committerPaul Buetow <paul@buetow.org>2026-03-11 22:40:31 +0200
commitccaff1ddf6e883bb1ad8753feede413326e488b0 (patch)
tree98cd22f5d3f49b2cb63e8189959b946c64123ba3 /internal/showcase/metadata_test.go
parent33c4f73deb57725b173402a5336138c481d083c0 (diff)
fix(showcase): penalize unreleased repositoriesv0.15.4
Diffstat (limited to 'internal/showcase/metadata_test.go')
-rw-r--r--internal/showcase/metadata_test.go19
1 files changed, 15 insertions, 4 deletions
diff --git a/internal/showcase/metadata_test.go b/internal/showcase/metadata_test.go
index 3aa49c1..e8777ce 100644
--- a/internal/showcase/metadata_test.go
+++ b/internal/showcase/metadata_test.go
@@ -10,8 +10,8 @@ import (
func TestCalculateRepoScore_IncreasesWithTagCount(t *testing.T) {
t.Parallel()
- withoutTags := calculateRepoScore(5000, 14, 0)
- withTags := calculateRepoScore(5000, 14, 10)
+ withoutTags := calculateRepoScore(5000, 14, 0, true)
+ withTags := calculateRepoScore(5000, 14, 10, true)
if withTags <= withoutTags {
t.Fatalf("expected tags to increase score, got without=%f with=%f", withoutTags, withTags)
@@ -21,14 +21,25 @@ func TestCalculateRepoScore_IncreasesWithTagCount(t *testing.T) {
func TestCalculateRepoScore_DecreasesWithAge(t *testing.T) {
t.Parallel()
- recent := calculateRepoScore(5000, 7, 3)
- old := calculateRepoScore(5000, 70, 3)
+ recent := calculateRepoScore(5000, 7, 3, true)
+ old := calculateRepoScore(5000, 70, 3, true)
if recent <= old {
t.Fatalf("expected newer activity to score higher, got recent=%f old=%f", recent, old)
}
}
+func TestCalculateRepoScore_DecreasesWithoutRelease(t *testing.T) {
+ t.Parallel()
+
+ released := calculateRepoScore(5000, 14, 3, true)
+ unreleased := calculateRepoScore(5000, 14, 3, false)
+
+ if unreleased >= released {
+ t.Fatalf("expected unreleased repo to score lower, got released=%f unreleased=%f", released, unreleased)
+ }
+}
+
func TestGetLatestTag_ReturnsTotalTagCount(t *testing.T) {
t.Parallel()