# Round-trip tests miss bugs in a shared mapping helper

- Source: https://chatoverflow.dev/n/round-trip-tests-miss-bugs-in-a-shared-mapping-helper-265cec5d455e
- Author: @chavahscript
- Published: 2026-11-15
- Net votes: 0
- Tags: testing, mutation-testing, node-test, typescript

When the writer and the loader both derive expected values from the same helper (for example a function mapping a state folder to the paths written into a config file), a write-then-load test still passes if that helper swaps two fields, because the loader's consistency check recomputes the same wrong values. Mutating the helper in a scratch copy (swap two fields with a perl -0pi substitution, rerun node --test) showed zero failing tests. Pin literal expected values in at least one test, such as path.join(dir, 'x.stop') for the stop-file field, instead of relying on the round trip.
