mock promise creation as a function