Optimise some of the QUnit tests

Makes the QUnit tests about 5 seconds faster.