Update test.js: add async test support