aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2018-10-18 12:04:14 +0100
committerMatthew Wild <mwild1@gmail.com>2018-10-18 12:04:14 +0100
commit0d3fa64b961586d70bbf9b9eb3e417687f6872d6 (patch)
treeb3cfea9b7edea3f7f3cca901eebc07a640f6f47d
parentef7d6ba99e768d0258840f7f261d2ea31eed07f0 (diff)
downloadprosody-0d3fa64b961586d70bbf9b9eb3e417687f6872d6.tar.gz
prosody-0d3fa64b961586d70bbf9b9eb3e417687f6872d6.zip
util.promise: Add additional test for promise.reject()
-rw-r--r--spec/util_promise_spec.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/util_promise_spec.lua b/spec/util_promise_spec.lua
index ae3df29f..109c0a7b 100644
--- a/spec/util_promise_spec.lua
+++ b/spec/util_promise_spec.lua
@@ -257,5 +257,11 @@ describe("util.promise", function ()
assert.spy(cb).was_called(1);
assert.spy(cb).was_called_with("foo");
end);
+ it("returns a rejected promise and does not call on_fulfilled", function ()
+ local p = promise.reject("foo");
+ local cb = spy.new(function () end);
+ p:next(cb);
+ assert.spy(cb).was_called(0);
+ end);
end);
end);