docs-parser icon indicating copy to clipboard operation
docs-parser copied to clipboard

test: add a bunch of tests

Open MarshallOfSound opened this issue 3 months ago • 2 comments

At one point this module had really good test coverage, then we added a bunch of stuff to it 😆 These are mostly claude generated test cases but I've gone through them and they all seem like in/out samples

MarshallOfSound avatar Nov 15 '25 07:11 MarshallOfSound

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​vitest/​coverage-v8@​3.0.5991007299100

View full report

socket-security[bot] avatar Nov 15 '25 08:11 socket-security[bot]

Some of these tests have expect calls inside conditional branches, which is a code smell. I'm guessing that was Claude trying to make the code pass type checking, but it can lead to those expect calls never running and the tests passing if something subtle changes. Those can be refactored using assert to both pass type checking and not be in a conditional branch that could get skipped.

This is a good call out that I missed 🙇 I updated all these to use type assertions instead as these are frequently code patterns of "assert foo -> assert foo.bar" where typescript doesn't understand vitests "expect" syntax is actually a typecheck.

Things looking a bit better now and typecheck now passing

MarshallOfSound avatar Nov 23 '25 20:11 MarshallOfSound