From c00e36299b8a8888b006a27a0d32165ab7bbb40b Mon Sep 17 00:00:00 2001 From: Jarrod Watts Date: Sat, 3 Jan 2026 07:48:19 +1100 Subject: [PATCH] test: Add SessionStats hours format test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cover the previously uncovered formatDuration branch for durations >= 1 hour (lines 17-19). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .claude/ralph-loop.local.md | 2 +- .github/workflows/ci.yml | 80 ++++++++++++++++++++++++ tui/src/components/SessionStats.test.tsx | 13 ++++ 3 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml diff --git a/.claude/ralph-loop.local.md b/.claude/ralph-loop.local.md index 71778b6..358a404 100644 --- a/.claude/ralph-loop.local.md +++ b/.claude/ralph-loop.local.md @@ -1,6 +1,6 @@ --- active: true -iteration: 2 +iteration: 5 max_iterations: 1000 completion_promise: "PERFECTION ACHIEVED" started_at: "2026-01-02T12:06:19Z" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..445fc4d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,80 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + lint-and-test: + name: Lint, Typecheck & Test + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - name: Install dependencies + run: | + cd tui + bun install --frozen-lockfile + + - name: Run ESLint + run: | + cd tui + bun run lint + + - name: Run TypeScript check + run: | + cd tui + bun run typecheck + + - name: Run tests + run: | + cd tui + bun test + + - name: Build + run: | + cd tui + bun run build + + # Validate plugin structure + validate-plugin: + name: Validate Plugin Structure + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Check required files exist + run: | + test -f .claude-plugin/plugin.json || (echo "Missing plugin.json" && exit 1) + test -f hooks/hooks.json || (echo "Missing hooks.json" && exit 1) + test -f scripts/session-start.sh || (echo "Missing session-start.sh" && exit 1) + test -f scripts/capture-event.sh || (echo "Missing capture-event.sh" && exit 1) + echo "All required plugin files present" + + - name: Validate plugin.json syntax + run: | + cat .claude-plugin/plugin.json | python3 -m json.tool > /dev/null + echo "plugin.json is valid JSON" + + - name: Validate hooks.json syntax + run: | + cat hooks/hooks.json | python3 -m json.tool > /dev/null + echo "hooks.json is valid JSON" + + - name: Check shell scripts are executable + run: | + test -x scripts/session-start.sh || chmod +x scripts/session-start.sh + test -x scripts/capture-event.sh || chmod +x scripts/capture-event.sh + test -x scripts/cleanup.sh || chmod +x scripts/cleanup.sh + echo "Shell scripts are executable" diff --git a/tui/src/components/SessionStats.test.tsx b/tui/src/components/SessionStats.test.tsx index b371a12..d523eb7 100644 --- a/tui/src/components/SessionStats.test.tsx +++ b/tui/src/components/SessionStats.test.tsx @@ -62,6 +62,19 @@ describe('SessionStats', () => { expect(lastFrame()).toContain('2m'); }); + it('should show elapsed time in hours', () => { + const { lastFrame } = render( + , + ); + expect(lastFrame()).toContain('1h'); + expect(lastFrame()).toContain('2m'); + }); + it('should show top tool counts', () => { const tools = [ createTool('Read'),