refactors tests to make less brittle