Property tests find the input you would not have thought of
For a parser, a serialiser or anything else with an inverse, the property "decode(encode(x)) equals x for all x" finds edge cases no example test ever would.
fc.assert(fc.property(fc.string(), (s) => decode(encode(s)) === s));fast-check generates thousands of inputs and shrinks any failure down to the smallest one. Empty strings, surrogate pairs and a lone backslash show up on the very first run.
testing