Real-World Tests#
Tests that fetch and validate real lexicons from production networks.
Tests#
roundtrip.rs - Round-Trip Test#
Validates that MLF can accurately convert lexicons: JSON → MLF → JSON
What it does:
- Fetches real lexicons from production networks:
app.bsky.actor.*,app.bsky.feed.*,app.bsky.graph.*net.anisota.*place.stream.*pub.leaflet.*
- Converts downloaded JSON to MLF (automatic during fetch)
- Generates JSON back from MLF files
- Compares original vs regenerated JSON
Running:
# Using just
just test-real-world
# Using cargo
cargo test -p mlf-integration-tests --test real_world_roundtrip -- --ignored --nocapture
Network-dependent: This test fetches from real networks, so it:
- Is marked
#[ignore]by default - Requires internet connectivity
- Takes 30-60 seconds to run
Diff files: When differences are found, the test writes three files per lexicon to roundtrip/diffs/:
{nsid}.original.json- The original fetched JSON{nsid}.generated.json- The regenerated JSON from MLF{nsid}.diff- Unified diff output (diff -u)
Files are organized into subdirectories:
diffs/acceptable/- Acceptable differences (field ordering,$typefields)diffs/failure/- Structural differences that indicate bugs
These files are gitignored but persisted locally for review.
Adding New Tests#
To add more real-world test sources:
- Edit
TEST_SOURCESinroundtrip.rs - Ensure the NSID has published DNS TXT records
- Test with
mlf fetch <nsid>first to verify
Notes#
- These tests validate the core MLF workflow end-to-end
- Failures indicate bugs in either JSON→MLF or MLF→JSON conversion
- Review diff files to diagnose what changed