Extract some common testing functions into TestUtils.js
Rename some test functions for clarity.