beads/cmd/bd/gitlab_integration_test.go
beads/crew/jane 43df89b2ff fix: repair nightly integration test compilation failures
Six categories of orphaned test references accumulated from prior
refactorings (JSONL removal, SQLite removal, daemon deletion, sync
engine rewrite):

- delete_test.go: remove removeIssueFromJSONL call and JSONL helpers
  (deleted in JSONL refactoring)
- dolt_autocommit_integration_test.go: restore setupGitRepoForIntegration
  and isDoltBackendUnavailable helpers (lost in SQLite backend removal)
- gitlab_integration_test.go: remove tests calling doPullFromGitLab,
  doPushToGitLab, detectGitLabConflicts (replaced by tracker.Engine)
- init_cancel_e2e_test.go: restore runGitCmd helper (lost in sync
  engine gut)
- update_custom_type_test.go, update_edge_cases_test.go: delete
  orphaned dual-mode tests referencing removed RunDualModeTest infra
- dolt_autostart_lifecycle_integration_test.go: rename redeclared
  runBDExecAllowErrorWithEnv to avoid conflict with cli_fast_test.go
- Add test_helpers_integration_test.go with initExecTestDB and
  createExecTestIssue helpers for CLI integration tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:05:48 -07:00

64 lines
1.9 KiB
Go

//go:build cgo && integration
// +build cgo,integration
// Package main provides the bd CLI commands.
package main
import (
"testing"
)
// TestGitLabConflictStrategiesIntegration tests conflict strategy selection.
func TestGitLabConflictStrategiesIntegration(t *testing.T) {
// Test prefer-newer strategy (default)
t.Run("PreferNewer", func(t *testing.T) {
strategy, err := getConflictStrategy(false, false, true)
if err != nil {
t.Fatalf("getConflictStrategy() error = %v", err)
}
if strategy != ConflictStrategyPreferNewer {
t.Errorf("strategy = %q, want %q", strategy, ConflictStrategyPreferNewer)
}
})
// Test prefer-local strategy
t.Run("PreferLocal", func(t *testing.T) {
strategy, err := getConflictStrategy(true, false, false)
if err != nil {
t.Fatalf("getConflictStrategy() error = %v", err)
}
if strategy != ConflictStrategyPreferLocal {
t.Errorf("strategy = %q, want %q", strategy, ConflictStrategyPreferLocal)
}
})
// Test prefer-gitlab strategy
t.Run("PreferGitLab", func(t *testing.T) {
strategy, err := getConflictStrategy(false, true, false)
if err != nil {
t.Fatalf("getConflictStrategy() error = %v", err)
}
if strategy != ConflictStrategyPreferGitLab {
t.Errorf("strategy = %q, want %q", strategy, ConflictStrategyPreferGitLab)
}
})
// Test default (no flags) returns prefer-newer
t.Run("DefaultIsPreferNewer", func(t *testing.T) {
strategy, err := getConflictStrategy(false, false, false)
if err != nil {
t.Fatalf("getConflictStrategy() error = %v", err)
}
if strategy != ConflictStrategyPreferNewer {
t.Errorf("strategy = %q, want %q (default)", strategy, ConflictStrategyPreferNewer)
}
})
// Test multiple flags returns error
t.Run("MultipleFlags", func(t *testing.T) {
_, err := getConflictStrategy(true, true, false)
if err == nil {
t.Error("Expected error for multiple conflicting flags")
}
})
}