Refactor some tests