cli/pkg/cli/daemon_test.go
Claude 6b321fe5c9
Some checks are pending
Security Scan / security (push) Waiting to run
refactor(ax): Pass 1 AX compliance sweep — banned imports, naming, tests
- Remove banned imports (fmt, log, errors, os, strings, path/filepath,
  encoding/json) from all cmd/ packages; replace with core.* primitives
  and cli.* wrappers
- Rename abbreviated variables (cfg→configuration, reg→registry,
  cmd→proc, c→toolCheck/checkBuilder, sb→builder, out→output,
  r→repo/reason, b→branchName) across config, doctor, pkgcmd, help
- Add usage-example comments to all exported functions in pkg/cli
  (strings.go, log.go, i18n.go)
- Add complete Good/Bad/Ugly test triads to all pkg/cli test files:
  new files for command, errors, frame_components, i18n, log, render,
  runtime, strings, utils; updated existing check, daemon, glyph,
  layout, output, ansi, commands, frame, prompt, stream, styles,
  tracker, tree

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 17:28:36 +00:00

26 lines
639 B
Go

package cli
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestDetectMode_Good(t *testing.T) {
t.Setenv("CORE_DAEMON", "1")
assert.Equal(t, ModeDaemon, DetectMode())
}
func TestDetectMode_Bad(t *testing.T) {
t.Setenv("CORE_DAEMON", "0")
mode := DetectMode()
assert.NotEqual(t, ModeDaemon, mode)
}
func TestDetectMode_Ugly(t *testing.T) {
// Mode.String() covers all branches including the default unknown case.
assert.Equal(t, "interactive", ModeInteractive.String())
assert.Equal(t, "pipe", ModePipe.String())
assert.Equal(t, "daemon", ModeDaemon.String())
assert.Equal(t, "unknown", Mode(99).String())
}