package claude import ( "context" "errors" "testing" "git.a-wan.net/alan/pipelines/internal/protocol" ) // The auto-continue choice is kept per Claude home beside, and apart from, // the automatic-switch choice; it is on by default. func TestAutoContinueIsAClaudeHomeChoice(t *testing.T) { ctx := context.Background() chat := directoryChat(t) directory := accountsHome(t, chat) if on, err := chat.AutoContinue(ctx, "s", directory); err != nil || !on { t.Fatalf("default = %v %v", on, err) } if err := chat.SetAutoContinue(ctx, "s", directory, false); err != nil { t.Fatal(err) } if on, err := chat.AutoContinue(ctx, "s", directory); err != nil || on { t.Fatalf("after off = %v %v", on, err) } list, err := chat.ClaudeAccounts(ctx, "s", directory, protocol.ClaudeAccounts, "") if err != nil || !list.AutoSwitch { t.Fatalf("auto-switch changed: %+v %v", list, err) } t.Setenv("CLAUDE_CONFIG_DIR", "") if _, err := chat.AutoContinue(ctx, "s", t.TempDir()); !errors.Is(err, ErrNoConfigDir) { t.Fatalf("a directory without a Claude home: %v", err) } }