Skip to content

chore(batfaster): split monolithic test files for maintainability#56

Closed
olavostauros wants to merge 2 commits into
KnickKnackLabs:mainfrom
olavostauros:chore/batfaster-chat
Closed

chore(batfaster): split monolithic test files for maintainability#56
olavostauros wants to merge 2 commits into
KnickKnackLabs:mainfrom
olavostauros:chore/batfaster-chat

Conversation

@olavostauros

@olavostauros olavostauros commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Split monolithic test files into domain-focused files for better maintainability, added setup_suite.bash, and added bats_require_minimum_version guards to all test files.

Changes

  1. Split tasks.bats (1253 lines, 111 tests) → 3 files:

    • tasks-read-send-sig.bats (38 tests) — read, send, sig tasks
    • tasks-list-status-unread.bats (44 tests) — list, status, unread, export
    • tasks-cursors-remove.bats (29 tests) — cursor:clear, cursor:undo, remove, non-existent channel
  2. Split chat_lib.bats (559 lines, 66 tests) → 4 files:

    • chat_lib-resolve.bats (20 tests) — resolve, require_file, identity
    • chat_lib-init-cursor.bats (12 tests) — init, line_count, cursor
    • chat_lib-messages.bats (18 tests) — append, new_messages, count_new
    • chat_lib-format.bats (16 tests) — list, timestamp, to_epoch, relative_time, trim
  3. Added test/setup_suite.bash with mise env toolpath setup

  4. Added bats_require_minimum_version 1.10.0 to all 8 test files

No test content was changed. Same 189 tests, zero failures.

Timing

Metric Before After Δ
Total time ~19.7s ~20.6s ≈ (within noise)
Tests 189 189 0 changes

Parallel execution note: Task-level tests invoke mise run inside the chat() shim, which acquires a mise lock. Parallel file execution would cause race conditions on that lock, so --jobs was intentionally omitted.

Validation

  • mise run test — 189/189 pass, 0 failures

  • codebase lint "$PWD" — all 9 rules passed

  • git diff --check — passes

  • readme build --check — passes

Split tasks.bats (111 tests) into 3 domain-focused files:
  - tasks-read-send-sig.bats (read, send, sig tasks)
  - tasks-list-status-unread.bats (list, status, unread, export)
  - tasks-cursors-remove.bats (cursor, remove, non-existent channel)

Split chat_lib.bats (66 tests) into 4 domain-focused files:
  - chat_lib-resolve.bats (resolve, require_file, identity)
  - chat_lib-init-cursor.bats (init, line_count, cursor)
  - chat_lib-messages.bats (append, new_messages, count_new)
  - chat_lib-format.bats (list, timestamp, to_epoch, relative_time, trim)

Added setup_suite.bash for consistent toolpath setup across all test files.

Added bats_require_minimum_version 1.10.0 to all 8 test files.

No test content changes — same 189 tests, zero failures.

Test timing: ~20s (unchanged — task-level tests use mise run shim,
so parallel execution is not possible due to mise lock contention).
@rikonor

rikonor commented Jun 23, 2026

Copy link
Copy Markdown

Metric Before After Δ
Total time ~19.7s ~20.6s ≈ (within noise)

Uhh Olavo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants