Skip to content

test: paint registry + parser エッジケース (+19)#58

Merged
Pregum merged 1 commit intomainfrom
test/paint-schema-parser-extra
Apr 23, 2026
Merged

test: paint registry + parser エッジケース (+19)#58
Pregum merged 1 commit intomainfrom
test/paint-schema-parser-extra

Conversation

@Pregum
Copy link
Copy Markdown
Owner

@Pregum Pregum commented Apr 23, 2026

Summary

231 → 250 tests (+19)

追加 件数 対象
tests/paintRegistry.test.ts 新規 9 buildPaintRegistry の全 paint kind / multi-fill / effect フィルタ / 再帰
tests/parser.test.ts 拡張 +10 passthrough、group/line/polygon/path、nested unsupported、null/string 拒否、error.summary

schema 直接テストについて

src/pen/schema.tsparsePen 経由で使われるため、parsePen の統合テストでカバーするほうが実用的と判断。直接 zod schema を検証するテストは追加しなかった。

また、zod の union に passthrough: z.object({ type: z.string(), id: z.string() }).passthrough() が入っているため、ルールに違反した有効型(例: rectangle の stroke.align に invalid 値)は unsupported にフォールバックして ok=true で通る。これは意図した挙動(ユーザーの .pen を部分的にでも表示するため)。

Test plan

  • npm test で 19 ファイル / 250 件全 pass
  • npm run build OK

🤖 Generated with Claude Code

追加:
- tests/paintRegistry.test.ts 新規 (9)
  - 空 doc / 単色のみ (fillMap に null) / gradient / mixed multi-fill /
    image ノード自身 / mesh_gradient kind / stroke.fill gradient /
    effects 配列 (enabled フィルタ) / nested frame 再帰
- tests/parser.test.ts 拡張 (+10)
  - passthrough fields 保持 (known / unknown 両方)
  - group / line / polygon / path の基本パース
  - frame 配下の unsupported 子
  - null / string 入力の拒否
  - error.summary が non-empty

既存 parser tests 9 → 19。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Pregum Pregum merged commit 5a780b6 into main Apr 23, 2026
1 check passed
@Pregum Pregum deleted the test/paint-schema-parser-extra branch April 23, 2026 06:15
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