Updated test to use when.Promise.