summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-28 10:22:56 +0300
committerPaul Buetow <paul@buetow.org>2026-05-28 10:22:56 +0300
commit7322ee6540e0772e9a43658b96a1401fc071aef8 (patch)
treeddab1bfb4595065f447854726b12dc64be0c61ff /internal
parent61ebe59a088af0f758115e63340552f3bbac7c19 (diff)
test(showcase): add non-version tag regression test (gq)
Diffstat (limited to 'internal')
-rw-r--r--internal/showcase/metadata_test.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/internal/showcase/metadata_test.go b/internal/showcase/metadata_test.go
index e905755..298de47 100644
--- a/internal/showcase/metadata_test.go
+++ b/internal/showcase/metadata_test.go
@@ -80,6 +80,42 @@ func TestGetLatestTag_ReturnsTotalTagCount(t *testing.T) {
}
}
+func TestGetLatestTag_OnlyNonVersionTags(t *testing.T) {
+ t.Parallel()
+
+ repoPath := t.TempDir()
+ runGit(t, repoPath, "init")
+ runGit(t, repoPath, "config", "user.name", "Test User")
+ runGit(t, repoPath, "config", "user.email", "test@example.com")
+
+ writeAndCommit := func(name, content, message string) {
+ path := filepath.Join(repoPath, name)
+ if err := os.WriteFile(path, []byte(content), 0644); err != nil {
+ t.Fatalf("write file %s: %v", name, err)
+ }
+ runGit(t, repoPath, "add", name)
+ runGit(t, repoPath, "commit", "-m", message)
+ }
+
+ writeAndCommit("README.md", "first", "first")
+ runGit(t, repoPath, "tag", "latest")
+ runGit(t, repoPath, "tag", "1-beta")
+
+ latestTag, _, hasReleases, tagCount, err := getLatestTag(repoPath)
+ if err != nil {
+ t.Fatalf("getLatestTag() error = %v", err)
+ }
+ if latestTag != "" {
+ t.Fatalf("latestTag = %q, want empty", latestTag)
+ }
+ if hasReleases {
+ t.Fatal("expected hasReleases to be false when only non-version tags exist")
+ }
+ if tagCount != 2 {
+ t.Fatalf("tagCount = %d, want %d", tagCount, 2)
+ }
+}
+
func TestExtractRepoMetadata_UsesCurrentBranchState(t *testing.T) {
t.Parallel()