MCPcopy Create free account
hub / github.com/codehamr/codehamr / TestHamrpassNoArgsShowsExplainerWhenUnset

Function TestHamrpassNoArgsShowsExplainerWhenUnset

internal/tui/tui_test.go:2910–2936  ·  view source on GitHub ↗

TestHamrpassNoArgsShowsExplainerWhenUnset: `/hamrpass` with no key set prints the guided block, including the unset status line and the purchase URL. No active-profile change.

(t *testing.T)

Source from the content-addressed store, hash-verified

2908 }
2909}
2910
2911// TestPopoverRenderRightAligns: each row ends flush with the popover width
2912// (== m.width after ANSI stripping). The value starts at column 0 and the
2913// description is right-aligned.
2914func TestPopoverRenderRightAligns(t *testing.T) {
2915 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
2916 mm := typeInto(m, "/")
2917 rendered := stripANSI(mm.renderPopover())
2918 for line := range strings.SplitSeq(rendered, "\n") {
2919 if line == "" {
2920 continue
2921 }
2922 if got := lipgloss.Width(line); got != mm.width {
2923 t.Fatalf("row width = %d, want %d: %q", got, mm.width, line)
2924 }
2925 // value starts at column 0: first rune is a slash
2926 if !strings.HasPrefix(line, "/") {
2927 t.Fatalf("row should start with the command name at column 0: %q", line)
2928 }
2929 }
2930}
2931
2932// TestHamrpassNoArgsShowsExplainerWhenUnset: `/hamrpass` with no key set
2933// prints the guided block, including the unset status line and the
2934// purchase URL. No active-profile change.
2935func TestHamrpassNoArgsShowsExplainerWhenUnset(t *testing.T) {
2936 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
2937 before := m.cfg.Active
2938 // Bootstrap seeds hamrpass with an empty key; assert the precondition
2939 // so the test fails loud if Default() ever changes.

Callers

nothing calls this directly

Calls 4

newTestModelFunction · 0.85
stripANSIFunction · 0.85
runSlashMethod · 0.80
StringMethod · 0.80

Tested by

no test coverage detected