MCPcopy Create free account
hub / github.com/Facets-cloud/flow / TestCmdDoWithFreshInjectsAfterBootstrap

Function TestCmdDoWithFreshInjectsAfterBootstrap

internal/app/do_test.go:983–1009  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

981
982// TestCmdDoHereForceOverwritesBinding pins that --force allows the
983// overwrite of a prior binding. The user has been told this orphans
984// the prior session.
985func TestCmdDoHereForceOverwritesBinding(t *testing.T) {
986 setupFlowRoot(t)
987 // Force-rebind still needs to satisfy the cwd-matches-work_dir
988 // invariant — the new session must have been started at work_dir.
989 seedTaskAtCwd(t, "force-task")
990 stubClaudeStatOK(t)
991
992 const oldSID = "deadbeef-1111-4222-8333-444455556666"
993 const newSID = "f00ba111-2222-4333-8444-555555555555"
994 db := openFlowDB(t)
995 if _, err := db.Exec(
996 `UPDATE tasks SET session_id=?, session_started=?, status='in-progress' WHERE slug='force-task'`,
997 oldSID, flowdb.NowISO(),
998 ); err != nil {
999 t.Fatal(err)
1000 }
1001 db.Close()
1002
1003 t.Setenv("CLAUDE_CODE_SESSION_ID", newSID)
1004 if rc := cmdDo([]string{"force-task", "--here", "--force"}); rc != 0 {
1005 t.Errorf("rc=%d, want 0 with --force", rc)
1006 }
1007 db = openFlowDB(t)
1008 task, _ := flowdb.GetTask(db, "force-task")
1009 if task.SessionID.String != newSID {
1010 t.Errorf("session_id after --force: got %q, want %s", task.SessionID.String, newSID)
1011 }
1012}

Callers

nothing calls this directly

Calls 4

setupFlowRootFunction · 0.85
seedTaskFunction · 0.85
stubITermFunction · 0.85
cmdDoFunction · 0.85

Tested by

no test coverage detected