TestIsBackground verifies the bg-mode selector. $FLOW_TERM=bg means "spawn as a terminal-free background agent" — distinct from the terminal backends Detect() returns, so it lives in its own predicate that do.go checks before any SpawnTab.
(t *testing.T)
| 16 | // terminal backends Detect() returns, so it lives in its own predicate |
| 17 | // that do.go checks before any SpawnTab. |
| 18 | func TestIsBackground(t *testing.T) { |
| 19 | cases := []struct { |
| 20 | flowTerm string |
| 21 | want bool |
| 22 | }{ |
| 23 | {"bg", true}, |
| 24 | {"", false}, |
| 25 | {"iterm", false}, |
| 26 | {"BG", false}, // case-sensitive, mirrors Detect's exact match |
| 27 | {"background", false}, |
| 28 | } |
| 29 | for _, tc := range cases { |
| 30 | t.Run(tc.flowTerm, func(t *testing.T) { |
| 31 | t.Setenv("FLOW_TERM", tc.flowTerm) |
| 32 | BackgroundOverride = nil |
| 33 | if got := IsBackground(); got != tc.want { |
| 34 | t.Errorf("IsBackground() with FLOW_TERM=%q: got %v, want %v", |
| 35 | tc.flowTerm, got, tc.want) |
| 36 | } |
| 37 | }) |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | // TestBackgroundOverrideBeatsEnv confirms the test escape hatch: setting |
| 42 | // BackgroundOverride pins IsBackground regardless of $FLOW_TERM, so tests |
nothing calls this directly
no test coverage detected