Skip to content

Run write-back on the sample notes' task lines - #77

Merged
rcasazza merged 1 commit into
mainfrom
test/write-back-on-sample-notes
Nov 25, 2026
Merged

rcasazza merged 1 commit into
mainfrom
test/write-back-on-sample-notes

Conversation

@rcasazza

Copy link
Copy Markdown
Member

What changed

  • tests/fixture-lines.ts (new): one list of task lines for the per-line suites. It holds the hand-written cases in task-lines.json plus the 63 task lines from the sample notes in tests/fixtures/obsidian-cache.json. The writeback, edit, board, calendar and bulk suites now use it instead of reading task-lines.json themselves.
  • tests/obsidian-cache.test.ts: a "write-back in place" test per sample note. It ticks, unticks and sets a due date on each task inside its whole note, then checks:
    • no other line and no line ending changes;
    • indent and marker are kept;
    • ticking then unticking restores the line;
    • the note still extracts the same tasks and nesting.
  • tests/fixtures/README.md and AGENTS.md describe the above.

Why

The real-cache test added in #76 showed which lines Obsidian treats as tasks in callouts, blockquotes, numbered lists, CRLF notes and odd markers. It didn't show that those lines can be ticked or edited safely. Before this change, task-lines.json had two blockquote cases and no callouts. Writing to the wrong place is the worst failure for this plugin, so these lines now get the same byte-safety, toggle and edit checks as the hand-written fixtures. New sample notes are covered automatically.

Results

  • No bugs found. The suite grows from 1,602 to 2,494 tests. npm run build, npm run lint and npm test pass.
  • To confirm the new checks can fail, I broke the "line untouched" assertion on purpose: all 10 whole-note tests failed, then passed again once restored.

Tests only; nothing changes for users.

🤖 Generated with Claude Code

The real-cache test showed which lines are tasks in callouts, blockquotes,
numbered lists and other tricky notes, but not that they can be ticked or
edited safely. Feed the 63 task lines from those notes into the per-line
suites (toggle, edit, board, calendar, bulk) alongside task-lines.json, and
tick, untick and set a due date on each task inside its whole note, checking
that no other line or line ending changes and the note's tasks and nesting
stay the same. No bugs found; the suite grows from 1,602 to 2,494 tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rcasazza
rcasazza merged commit 0dbe74a into main Nov 25, 2026
2 checks passed
@rcasazza
rcasazza deleted the test/write-back-on-sample-notes branch November 25, 2026 12:03
@rcasazza rcasazza mentioned this pull request Nov 25, 2026
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.

1 participant