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
commit52810113d8176f26bf8d8fe0049dc331302f56dc (patch)
treeb3cfea9b7edea3f7f3cca901eebc07a640f6f47d
parent90b256a19dbf96d6b3af5252c3df158c0a619b3f (diff)
downloadprosody-52810113d8176f26bf8d8fe0049dc331302f56dc.tar.gz
prosody-52810113d8176f26bf8d8fe0049dc331302f56dc.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);