ajhahn.de
← eeco
Go 36 lines
package config

import (
	"os"
	"path/filepath"
	"testing"
)

func TestReconcilesCockpit(t *testing.T) {
	if !AutomationAuto.ReconcilesCockpit() {
		t.Error("auto should reconcile the cockpit")
	}
	for _, a := range []Automation{AutomationManual, AutomationPropose, AutomationScaffold} {
		if a.ReconcilesCockpit() {
			t.Errorf("%s should not reconcile the cockpit", a)
		}
	}
}

func TestHandoverGlobParse(t *testing.T) {
	ws := filepath.Join(t.TempDir(), ".eeco")
	if err := os.MkdirAll(ws, 0o755); err != nil {
		t.Fatal(err)
	}
	if err := os.WriteFile(filepath.Join(ws, "config.local"), []byte("handover_glob=ajhahnde/RESUME*.md\n"), 0o644); err != nil {
		t.Fatal(err)
	}
	cfg := &Config{Workspace: ws}
	if err := applyLocal(cfg); err != nil {
		t.Fatal(err)
	}
	if cfg.HandoverGlob != "ajhahnde/RESUME*.md" {
		t.Errorf("HandoverGlob = %q, want ajhahnde/RESUME*.md", cfg.HandoverGlob)
	}
}