test: Simplify assertions by helper function