Changeset

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
parents 9510:8ef46d09386a
children 9512:439cf3bbe5f3
files spec/util_promise_spec.lua
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/spec/util_promise_spec.lua	Thu Oct 18 12:03:33 2018 +0100
+++ b/spec/util_promise_spec.lua	Thu Oct 18 12:04:14 2018 +0100
@@ -257,5 +257,11 @@
 			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);