Refactor generator tests to work as expected