dotfiles/claude/tests/run.sh
Jonny Barnes 545ca95068
Read thinking state from the payload and show the effort level
The indicator read alwaysThinkingEnabled from settings.json, which Option+T
never writes - it toggles thinking for the session only. The key was also
absent here, so `// false` pinned the segment to the hollow "off" diamond
while thinking was actually on: an inverted indicator, not just a stale one.

Claude Code pipes the live state in as .thinking.enabled, alongside
.effort.level. Read both, in one jq pass since the line re-renders on every
redraw. Absent thinking means enabled, matching the renderer's own
`thinking:{enabled: lt !== false}`.

The effort level now replaces the static "thinking" label, so the segment
says something that changes: "◆ high" rather than a word that was there
either way. Unrecognised levels fall back to the old label, since the wrap
branch sizes line one from this string.

Test widths are usable widths, not raw terminal widths: the tiers are
computed after padding is subtracted, so a raw width would change tier
whenever statusLine.padding did. The usage cache is seeded for the same
reason width_test.sh seeds it - an unseeded cache makes the first render
fetch live usage over the network.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-02 20:17:12 +01:00

27 lines
874 B
Shell
Executable file

#!/bin/bash
# Run every test for claude/statusline.isaacaudet.sh.
#
# Usage: claude/tests/run.sh
#
# The tests render the status line directly, so they need the same tools it
# does (bash, jq, git, python3). They point STATUSLINE_CACHE_DIR at a temporary
# directory and write their fixtures there, so the caches the live status line
# reads are never touched.
cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1
status=0
for t in statusline.isaacaudet.payload_test.sh \
statusline.isaacaudet.thinking_test.sh \
statusline.isaacaudet.width_test.sh \
statusline.isaacaudet.cache_test.sh; do
echo "== $t"
bash "$t" || status=1
echo
done
echo "== statusline.isaacaudet.overflow_test.py"
python3 statusline.isaacaudet.overflow_test.py || status=1
echo
[ "$status" -eq 0 ] && echo "ALL TESTS PASSED" || echo "SOME TESTS FAILED"
exit "$status"