Skip to content

test: add NoteConvertTests smoke coverage (.note → pdf/html) to MacDocCLITests #81

@kiki830621

Description

@kiki830621

Problem

From verification of #78 (#78 verify report, finding #7):
「『26 tests passed』claim in commit body is misleading: 565f4c2 adds zero tests; the 26 are pre-existing MacDocCLITests + WordToMDTests that don't exercise NoteToPDF/NoteToHTML at all.」
— Source: devils-advocate, 2026-04-18

After #78 extracted note-* packages to remote repos, macdoc has zero automated test coverage for the convert --to pdf (NoteToPDF) and convert --to html (NoteToHTML) paths. The existing MacDocCLITests and WordToMDTests exercise Word/HTML/Markdown conversions only.

If a future refactor breaks linking between macdoc and the remote note-*-swift packages, no test would catch it — only manual smoke-testing with a .note file would.

Type

enhancement

Expected

Add a smoke-test target (e.g., MacDocCLITests/NoteConvertTests.swift) that:

  • Bundles a small sample .note file as a test resource (via .copy("Fixtures/"))
  • Runs macdoc convert --to pdf <sample.note> end-to-end via Process API
  • Asserts: exit code 0, output file exists, file is a valid PDF (magic bytes), Producer string matches expected
  • Same for --to html

Optionally, add a sibling test that compares a regression baseline (e.g., expected page count, expected text content via pdftotext).

Actual

swift test  # → 26 tests pass, ALL in MacDocCLITests + WordToMDTests; nothing exercises Note* paths

Tests/MacDocCLITests/ contains only Convert/HTMLToPDF/Bib/Error/etc tests — no Note coverage.

Strategy

Related


Current Status

Phase: closed
Last updated: 2026-04-19 by idd-close

Key Decisions

  • Closed 2026-04-19 — PASS after 6-AI ensemble verify + in-scope fixes for Producer/page-count/noteFixture determinism
  • Verified 2026-04-19 via 5 Claude reviewers + Codex (gpt-5.4 xhigh) ensemble; Devil's Advocate + Codex caught Producer-string gap that 4 Claude reviewers missed
  • In-scope fixes applied (amended into ae4bab3): Producer Quartz PDFContext assertion, pdf.pageCount >= 1, sorted deterministic fallback in noteFixture(), propagate I/O errors instead of masking as "not found"
  • Follow-up test: strengthen Note→HTML smoke assertions (media/ dir + size floor) #86 filed: strengthen Note→HTML assertions (media/ dir + size floor) — mirrors PDF strengthening
  • Implemented on branch test/note-convert-smoke-81; commit ff343b51631251 (CLAUDE.md amend) → ae4bab3 (verify fixes)
  • 4 files / +169/-0 lines; 28 tests green (26 Swift Testing + 2 new XCTest)
  • Discovered + encoded 2 CLI contracts in the tests: note→html requires --css dark|light; note→html outputs a directory (index.html + media/), not a single file
  • Complexity: Simple — no SDD needed; 2 test files, zero production-code change
  • Fixture strategy: Option B (use test-files/筆記 2026-03-20 15_25_20.note + XCTSkip fallback) — MVP; committable small fixture deferred to refactor: extract pdf-to-latex-swift + ocr-swift to PsychQuant repos; commit Tests/WordToMDTests fixtures (continues #78 pattern) #79

Scope Changes

  • In-scope strengthening during verify: Producer-string + page-count + fixture-lookup determinism (kept on same issue rather than spawning sub-PR)

Blocking

  • (none — closed; merge pending)

Commits

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions