Skip to content

test(core): add integration tests for public API surface#37

Merged
lostmygithubaccount merged 1 commit into
mainfrom
agent3/core-integration-tests
Apr 13, 2026
Merged

test(core): add integration tests for public API surface#37
lostmygithubaccount merged 1 commit into
mainfrom
agent3/core-integration-tests

Conversation

@lostmygithubaccount
Copy link
Copy Markdown
Member

Summary

Adds crates/draw-core/tests/integration.rs exercising draw-core as an external consumer would — only pub use re-exports from the crate root, cross-module flows, and previously untested API surface.

New coverage:

  • Full pipeline, all 7 element types: Rect/Ellipse/Diamond/Line/Arrow/FreeDraw/Text -> JSON round-trip -> save/load -> SVG export (per-type tag checks) -> PNG export (magic bytes).
  • Arrow bindings round-trip: start_binding / end_binding were added in feat(core): add arrow snap-to-shape connection points #35 but had zero test coverage. Now tested end-to-end through serde.
  • Legacy doc parsing: pre-binding documents still deserialize, binding fields default to None.
  • Element dispatch helpers: id() / position() / set_position() / opacity() / is_locked() / group_id() walked across every variant.
  • Empty-document exports don't panic (regression guard for the zero-element SVG/PNG fast-path).

Rationale: inline #[cfg(test)] modules can import from crate::, which can mask a broken pub use. An integration-style tests/ file validates the declared surface area.

Test plan

  • cargo test --package dkdc-draw-core --test integration — 6/6 pass
  • bin/check green

🤖 Generated with Claude Code

Existing coverage is per-module unit tests. This adds a tests/integration.rs
exercising draw-core as an external consumer would — only `pub use` re-exports
from the crate root.

New coverage:
- Full pipeline across all 7 element types: new -> populate -> JSON round-trip
  -> save/load -> SVG export (per-type tag checks) -> PNG export (magic bytes)
- Arrow start_binding/end_binding round-trip (Binding added in #35, had no
  test coverage)
- Legacy doc parsing when binding fields are absent (serde default=None)
- Element dispatch helpers (id/position/set_position/opacity/is_locked/group_id)
  across every variant
- Empty-document SVG/PNG exports don't panic

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lostmygithubaccount lostmygithubaccount merged commit b869add into main Apr 13, 2026
1 check passed
@lostmygithubaccount lostmygithubaccount deleted the agent3/core-integration-tests branch April 13, 2026 03:26
lostmygithubaccount added a commit that referenced this pull request Apr 13, 2026
Bumps all Rust crates and the Python package from 0.2.1 to 0.3.0. This
minor bump reflects one breaking change in the dkdc-draw-core public API
surface (pub -> pub(crate) demotions in #42), accumulated with the
non-breaking work from this cycle:

  - #35: arrow snap-to-shape connection points
  - #36: CONTRIBUTING.md + README badges
  - #37: integration tests for draw-core public API
  - #38: Rust + Python hello-world examples
  - #39: CHANGELOG.md scaffolding
  - #40: surgical clippy opt-ins workspace-wide
  - #41: sample gallery (5 drawings × json/svg/png)
  - #42: pub -> pub(crate) demotions (BREAKING)
  - #43: Python test coverage 5 -> 27

See CHANGELOG.md for the 0.3.0 section and migration notes for the
demoted symbols.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@lostmygithubaccount lostmygithubaccount mentioned this pull request Apr 13, 2026
4 tasks
lostmygithubaccount added a commit that referenced this pull request Apr 13, 2026
Bumps all Rust crates and the Python package from 0.2.1 to 0.3.0. This
minor bump reflects one breaking change in the dkdc-draw-core public API
surface (pub -> pub(crate) demotions in #42), accumulated with the
non-breaking work from this cycle:

  - #35: arrow snap-to-shape connection points
  - #36: CONTRIBUTING.md + README badges
  - #37: integration tests for draw-core public API
  - #38: Rust + Python hello-world examples
  - #39: CHANGELOG.md scaffolding
  - #40: surgical clippy opt-ins workspace-wide
  - #41: sample gallery (5 drawings × json/svg/png)
  - #42: pub -> pub(crate) demotions (BREAKING)
  - #43: Python test coverage 5 -> 27

See CHANGELOG.md for the 0.3.0 section and migration notes for the
demoted symbols.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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