Consolidated testing code in test.js.