3 ms·
Does anyone else use unit tests as a form of interactive development? For languages like typescript and kotlin, I’ve found them useful in situations where I d
by adregan 5y ago
Does anyone else use unit tests as a form of interactive development?
For languages like typescript and kotlin, I’ve found them useful in situations where I don’t have a repl available.
Custom react hooks are much easier (and faster) to develop in unit tests without having to load in a whole application. Exploring data models and their functions before implementing views is easier in unit tests.
I find unit tests to be a really productive playground and I think it’s great to have a place to later jump in and extend functionality in a safe space.
- ramses0 5y agoTests ensure you always have two consumers for an API (the API "in-place" as used by the functional portion of your system, as well as "how the tests use it"). This ensures new uses of the API have a path/model to follow and prevents you from having to "instantiate the world" just to call your particular function. I also think of tests as "scaffolding" when building a skyscraper. They make it easier to access certain "things" before they're fully complete and are a cost that makes building the actually building less risky and quicker. Why does no-one question the value of paying for putting up and tearing down a scaffold when building or repairing a building, but can't see the value of unit testing?