Refactor transaction test