Skip to content

test: strengthen Note→HTML smoke assertions (media/ dir + size floor) #86

@kiki830621

Description

@kiki830621

Problem

From verification of #81 (#81 verify report, Finding #6):
「HTML 14-byte stub passes the test — no media/ dir check, no size floor. A converter regression that drops all strokes but keeps the HTML shell would go undetected.」
— Source: devils-advocate, 2026-04-19

NoteHTMLConvertTests.testNoteToHTMLSmoke() asserts exit code 0, output directory exists, index.html exists, and index.html contains <html (case-insensitive). A byte-minimal stub like <html></html> (14 bytes, no media/, no stroke data) would pass all of these.

A converter regression that silently drops all stroke rendering but keeps the HTML shell would not be caught.

Type

enhancement

Expected

Strengthen NoteHTMLConvertTests with at least two additional assertions:

  1. media/ directory exists with ≥ 1 file — note-to-html-swift outputs stroke images and (optionally) audio to media/; an empty media/ means no strokes rendered
  2. index.html size floor — a non-trivial floor (e.g., ≥ 2 KB) catches the empty-shell regression. Choose the floor from a reference render of the current fixture and pin it.

Optionally: for a more behaviour-pinned assertion, parse index.html with a minimal DOM check (e.g., <svg> stroke element count > 0, or JSON-embedded stroke-data size ≥ N).

Actual

// NoteHTMLConvertTests.swift:49-53 — current assertion
XCTAssertTrue(
    content.lowercased().contains("<html"),
    "index.html SHALL contain an <html tag"
)

Passes for any index.html containing <html, including a 14-byte stub with no actual content.

Strategy

  • Add media/ directory existence + content check (≥ 1 file) to NoteHTMLConvertTests
  • Add index.html size floor assertion (baseline from reference render of current fixture; pin the number in a comment with date + fixture name so future rebaselining is traceable)
  • Consider a stroke-count assertion (parse index.html for SVG <path> or embedded JSON stroke array length) — evaluate whether it's worth the brittleness vs. the size-floor proxy

Related

Current Status

Phase: diagnosed
Last updated: 2026-04-22 by idd-diagnose (batch)

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