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

Function TestFocusSessionScriptMissReturnsFalse

internal/iterm/iterm_test.go:150–164  ·  view source on GitHub ↗

TestFocusSessionScriptMissReturnsFalse covers the case where ps found a match but iTerm2's AppleScript walked all sessions without finding the tty (e.g., the claude is in a non-iTerm tty, or the session was closed between ps and osascript).

(t *testing.T)

Source from the content-addressed store, hash-verified

148// finding the tty (e.g., the claude is in a non-iTerm tty, or the
149// session was closed between ps and osascript).
150func TestFocusSessionScriptMissReturnsFalse(t *testing.T) {
151 const uuid = "11111111-2222-4333-8444-555555555555"
152 const psOutput = ` PID TTY COMMAND
15312345 ttys012 /Users/me/.bun/bin/claude --session-id 11111111-2222-4333-8444-555555555555
154`
155 stubPS(t, psOutput, nil)
156 stubRunnerOutput(t, func(args []string) ([]byte, error) {
157 return []byte("miss"), nil
158 })
159
160 focused, err := FocusSession(uuid, "claude")
161 if focused || err != nil {
162 t.Errorf("got (%v, %v); want (false, nil) for script miss", focused, err)
163 }
164}
165
166// TestFocusSessionPSError surfaces the error to the caller instead of
167// silently treating it as "no match". The caller can then decide

Callers

nothing calls this directly

Calls 3

stubPSFunction · 0.70
stubRunnerOutputFunction · 0.70
FocusSessionFunction · 0.70

Tested by

no test coverage detected