Improve unit testing of Promise