Expressing a datatype-generic function like validate() requires hitting the any type really hard which makes it absolutely the most important code to get right, as the type system gives us so many fewer guarantees about the structure in there. 100% test coverage is more of a starting point for reliability than an ending point; as a friend on Twitter pointed out, function sin(x) { return x; } has 100% coverage if all you test is expect(sin(0)).toBe(0). But here I really do want to make sure that all of the branches have worked out at least once before.
Expressing a datatype-generic function like
validate()requires hitting theanytype really hard which makes it absolutely the most important code to get right, as the type system gives us so many fewer guarantees about the structure in there. 100% test coverage is more of a starting point for reliability than an ending point; as a friend on Twitter pointed out,function sin(x) { return x; }has 100% coverage if all you test isexpect(sin(0)).toBe(0). But here I really do want to make sure that all of the branches have worked out at least once before.