update test.js to run in node and browser (for comparision)