Peter Brownlow

https://www.chickennation.com/voting/

See the full thing (that’s just the first page above) at https://www.chickennation.com/voting/ . If you’re not Australian, this is how voting for a local representative in Australia works, and this comic strip makes short work of explaining it.

That adorable and useful voting guide came out a few years ago, from an artist called Patrick Alexander. With voting in the Australian federal election only weeks away it popped up again.

I learned that it has a sequel: What’s the Go with Voting for the Senate?

Click the link for the full thing, but here’s the first page:

--

--

Photo by Gabriel Heinzer on Unsplash

This is not an April Fool, you really should expect them!

I was writing some code in Node and testing in Jest, but I had trouble writing expect() assertions in a way that caught errors thrown from asynchronous code.

Synchronous? No problem. expect(something()).toThrow();

Async and no throw? No problem. expect(something()).toResolve.toEqual(expectedResult);

Async and expecting an error? No way. expect(something()).toResolve.toThrow() absolutely did not work for me. It didn’t stop on the error being thrown and I got a stack trace printed asynchronously in logs.

I really wanted to write test assertions that read fluently.

So, I wrote my own helper.

Usage:

expect(await asyncErrorFrom(asyncFunction)).toEqual(Error(message));

Code:

async function asyncErrorFrom(asyncFunction) {
let caught = null;
try {
await asyncFunction();
} catch (error) {
caught = error;
}
return caught;
}

--

--