Rewrite function parameter testing with cleaner async structure