michaelhelvey.dev

Blog

My reflections on programming, what I'm working on in open source, or what I'm learning about at the moment.

November 29, 2022 · 6 min read

Table-Driven Development

Use table-like datastructures to express your code as data and limit error-prone logic.

Have you ever written code that looked like this? enum Foo { first = 'first', second = 'second', third = 'third' } /** * Given some string, determines what kind of "Foo" it is. */ function classifyFoo(value: string): Foo { if (value === 'foo') { return Foo.first } else if (value === 'bar'...

Read More
September 10, 2022 · 4 min read

Testing Node.js APIs with Microtest

Microtest 2.0 is a utility library for integration testing Node.js applications

Microtest was born from the desire to test my Node.js APIs the same way that they would be consumed by clients: by making real HTTP requests to a real server. I believe that tests are most effective when they most closely resemble the way the software will ultimately be used, and for an API, that ...

Read More