Test that promise.then returns a promise
Fix missing return from promise#then
Move wrap to a prototype function