8000 test(compat): cross-platform .graph file compatibility tests (closes #150) by adityamukho · Pull Request #154 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

test(compat): cross-platform .graph file compatibility tests (closes #150) - #154

Merged
adityamukho merged 4 commits into
mainfrom
fix/issue-150-cross-platform-compat-tests
Apr 18, 2026
Merged

adityamukho merged 4 commits into
mainfrom
fix/issue-150-cross-platform-compat-tests

Conversation

@adityamukho
Copy link
Copy Markdown
Collaborator

Summary

Adds tests for the native ↔ browser WASM .graph file format compatibility invariant documented in BrowserDb::export_graph / import_graph.

  • tests/fixtures/compat.graph — committed binary fixture (v7, 28KB) with two known facts: :alice :name "Alice" and :alice :age 30. Generated by cargo run --example generate_compat_fixture; regenerate only if the v7 format changes.
  • examples/generate_compat_fixture.rs — documents how the fixture was produced and how to regenerate it.
  • tests/cross_platform_compat_test.rs — two native integration tests:
    • native_raw_page_bytes_round_trip: transacts facts, checkpoints, reads raw file bytes, writes them to a second path, reopens — mirrors export_graph / import_graph page-concatenation semantics natively
    • fixture_readable_by_native: loads the committed fixture via Minigraf::open, asserts known facts
  • src/browser/mod.rs — adds native_fixture_readable_by_browser_db wasm-bindgen-test: embeds the same fixture via include_bytes!, calls BrowserDb::import_graph, asserts facts — the native → browser direction

Test plan

  • cargo test --test cross_platform_compat_test passes (native side)
  • wasm-pack test --headless --chrome --features browser passes (browser side, including native_fixture_readable_by_browser_db)
  • CI green

🤖 Generated with Claude Code

adityamukho and others added 2 commits April 18, 2026 18:37
Add two native integration tests and one browser wasm-bindgen-test
verifying that .graph bytes are readable across the native ↔ browser
WASM boundary.

Native side (tests/cross_platform_compat_test.rs):
- native_raw_page_bytes_round_trip: transact facts, checkpoint, read
  raw bytes, write to a second file, reload — mirrors export_graph /
  import_graph page concatenation semantics
- fixture_readable_by_native: loads tests/fixtures/compat.graph (the
  committed binary fixture) via Minigraf::open and asserts known facts

Browser side (src/browser/mod.rs):
- native_fixture_readable_by_browser_db: embeds the same fixture via
  include_bytes!, calls BrowserDb::import_graph, asserts same facts —
  the native → browser direction of the cross-boundary test

Fixture (tests/fixtures/compat.graph):
- Generated by examples/generate_compat_fixture.rs
- v7 format, two facts: :alice :name "Alice", :alice :age 30
- Committed so wasm-pack tests can embed it without a build step

Closes #150

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@adityamukho adityamukho linked an issue Apr 18, 2026 that may be closed by this pull request
4 tasks
wasm-pack compiles integration tests for the browser target too.
Minigraf::open() is not available on wasm32, causing compile errors.
Add #![cfg(not(target_arch = "wasm32"))] to exclude the file entirely.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov
codecov Bot commented Apr 18, 2026 •
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.41%. Comparing base (005909c) to head (e45ee38).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #154   +/-   ##
=======================================
  Coverage   83.41%   83.41%           
=======================================
  Files          26       26           
  Lines        4837     4837           
=======================================
  Hits         4035     4035           
  Misses        802      802           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

wasm-pack compiles examples when running browser tests. Add a no-op
wasm32 main() so the example compiles cleanly under wasm-pack, while
keeping the native implementation under cfg(not(target_arch = "wasm32")).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@adityamukho
adityamukho merged commit 3d676c7 into main Apr 18, 2026
29 of 30 checks passed
@adityamukho
adityamukho deleted the fix/issue-150-cross-platform-compat-tests branch April 18, 2026 13:22
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.

Test: cross-platform .graph file compatibility (native ↔ browser WASM)

1 participant

0