DRY test cases

Some code cleanup to avoid duplication of test cases in `test-duplex.js` and `test.js`.

My solution is to simply reuse `test.js` in 'test-duplex.html'.

This does NOT affect my other pull request (#6).