Software /
code /
prosody
Comparison
spec/util_promise_spec.lua @ 9510:8ef46d09386a
util.promise: Fix promise.reject() to return a rejected promise, and fix buggy test for it
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 18 Oct 2018 12:03:33 +0100 |
parent | 9457:d01cff2f7a26 |
child | 9511:cb88d729e98d |
comparison
equal
deleted
inserted
replaced
9509:b57353f76c83 | 9510:8ef46d09386a |
---|---|
251 end); | 251 end); |
252 describe("reject()", function () | 252 describe("reject()", function () |
253 it("returns a rejected promise", function () | 253 it("returns a rejected promise", function () |
254 local p = promise.reject("foo"); | 254 local p = promise.reject("foo"); |
255 local cb = spy.new(function () end); | 255 local cb = spy.new(function () end); |
256 p:next(cb); | 256 p:catch(cb); |
257 assert.spy(cb).was_called(1); | 257 assert.spy(cb).was_called(1); |
258 assert.spy(cb).was_called_with("foo"); | 258 assert.spy(cb).was_called_with("foo"); |
259 end); | 259 end); |
260 end); | 260 end); |
261 end); | 261 end); |