Move helper function out of test block.