Refactor transaction tests