test(functional): factor out helper functions