Software /
code /
prosody
Comparison
spec/util_promise_spec.lua @ 9511:cb88d729e98d
util.promise: Add additional test for promise.reject()
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 18 Oct 2018 12:04:14 +0100 |
parent | 9510:8ef46d09386a |
child | 9514:9db707a86a25 |
comparison
equal
deleted
inserted
replaced
9510:8ef46d09386a | 9511:cb88d729e98d |
---|---|
255 local cb = spy.new(function () end); | 255 local cb = spy.new(function () end); |
256 p:catch(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 it("returns a rejected promise and does not call on_fulfilled", function () | |
261 local p = promise.reject("foo"); | |
262 local cb = spy.new(function () end); | |
263 p:next(cb); | |
264 assert.spy(cb).was_called(0); | |
265 end); | |
260 end); | 266 end); |
261 end); | 267 end); |