test(cloudfunc) refactor