Refactored tests to structured style with correct engine switching by using BDD-style description and QUnit-style assertions.