Refactor and update Qunit tests