From 7322ee6540e0772e9a43658b96a1401fc071aef8 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 28 May 2026 10:22:56 +0300 Subject: test(showcase): add non-version tag regression test (gq) --- internal/showcase/metadata_test.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'internal') 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() -- cgit v1.2.3