Optimise some of the QUnit tests

Makes the QUnit tests about 8 seconds faster.