test: put common code in a helper module