Move some helpers from test.js to utils.js