move test code out into test/test.js