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

Function TestIsBackground

internal/spawner/spawner_test.go:18–39  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

16// terminal backends Detect() returns, so it lives in its own predicate
17// that do.go checks before any SpawnTab.
18func 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

Callers

nothing calls this directly

Calls 1

IsBackgroundFunction · 0.85

Tested by

no test coverage detected