Skip to content

Commit 00ed1ec

Browse files
committed
test(integration): extract repeated reftable ref-format literal to a constant
goconst flagged the "reftable" string used in three --show-ref-format comparisons. Introduce refFormatReftable and use it in all three. Assisted-by: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Paulo Gomes <paulo@entire.io> Entire-Checkpoint: 01KYM8T9XXX11KRZH39K62HE1X
1 parent 6d60593 commit 00ed1ec

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

cmd/entire/cli/integration_test/reftable_repo_test.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ import (
1414
"github.com/entireio/cli/cmd/entire/cli/testutil"
1515
)
1616

17+
// refFormatReftable is git's rev-parse --show-ref-format value for a repository
18+
// using the reftable ref backend.
19+
const refFormatReftable = "reftable"
20+
1721
// TestReftableRepository_EnableAndFirstCheckpoint exercises the full capture
1822
// flow (enable -> session start -> file changes -> stop -> user commit ->
1923
// checkpoint) against a repository using the reftable ref backend. go-git's
@@ -36,7 +40,7 @@ func TestReftableRepository_EnableAndFirstCheckpoint(t *testing.T) {
3640
gitOutput(t, env.RepoDir, "add", "README.md")
3741
gitOutput(t, env.RepoDir, "commit", "-m", "Initial reftable commit")
3842

39-
if got := gitOutput(t, env.RepoDir, "rev-parse", "--show-ref-format"); got != "reftable" {
43+
if got := gitOutput(t, env.RepoDir, "rev-parse", "--show-ref-format"); got != refFormatReftable {
4044
t.Fatalf("repository ref format = %q, want reftable", got)
4145
}
4246

@@ -142,7 +146,7 @@ func TestReftableRepository_LinkedWorktree(t *testing.T) {
142146
// at the worktree directory.
143147
runCLIIn(t, env, worktreePath, "enable", "--no-github", "--agent", "claude-code", "--telemetry=false")
144148

145-
if got := gitOutput(t, worktreePath, "rev-parse", "--show-ref-format"); got != "reftable" {
149+
if got := gitOutput(t, worktreePath, "rev-parse", "--show-ref-format"); got != refFormatReftable {
146150
t.Fatalf("worktree ref format = %q, want reftable", got)
147151
}
148152

@@ -184,7 +188,7 @@ func requireGitReftableSupport(t *testing.T) {
184188
if output, err := cmd.CombinedOutput(); err != nil {
185189
t.Skipf("git does not support reftable repositories: %v\n%s", err, output)
186190
}
187-
if got := gitOutput(t, dir, "rev-parse", "--show-ref-format"); got != "reftable" {
191+
if got := gitOutput(t, dir, "rev-parse", "--show-ref-format"); got != refFormatReftable {
188192
t.Skipf("git initialized ref format %q, not reftable", got)
189193
}
190194
}

0 commit comments

Comments
 (0)