Software /
code /
prosody
Comparison
spec/util_promise_spec.lua @ 9551:7421379ba464
util.promise tests: Fix declared but unused variables
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 25 Oct 2018 15:33:46 +0100 |
parent | 9550:98de4c2e2627 |
child | 9557:d7fdd418adf8 |
comparison
equal
deleted
inserted
replaced
9550:98de4c2e2627 | 9551:7421379ba464 |
---|---|
181 local cb = spy.new(function () end); | 181 local cb = spy.new(function () end); |
182 local p2 = p:catch(cb); | 182 local p2 = p:catch(cb); |
183 assert.spy(cb).was_called(0); | 183 assert.spy(cb).was_called(0); |
184 | 184 |
185 local cb2 = spy.new(function () end); | 185 local cb2 = spy.new(function () end); |
186 local p3 = p2:catch(cb2); | 186 p2:catch(cb2); |
187 assert.spy(cb2).was_called(0); | 187 assert.spy(cb2).was_called(0); |
188 end); | 188 end); |
189 | 189 |
190 it("rejected promises do not call fulfilled handlers and do propagate reason", function () | 190 it("rejected promises do not call fulfilled handlers and do propagate reason", function () |
191 local p = promise.reject("foo"); | 191 local p = promise.reject("foo"); |
193 local p2 = p:next(cb); | 193 local p2 = p:next(cb); |
194 assert.spy(cb).was_called(0); | 194 assert.spy(cb).was_called(0); |
195 | 195 |
196 local cb2 = spy.new(function () end); | 196 local cb2 = spy.new(function () end); |
197 local cb2_err = spy.new(function () end); | 197 local cb2_err = spy.new(function () end); |
198 local p3 = p2:next(cb2, cb2_err); | 198 p2:next(cb2, cb2_err); |
199 assert.spy(cb2).was_called(0); | 199 assert.spy(cb2).was_called(0); |
200 assert.spy(cb2_err).was_called(1); | 200 assert.spy(cb2_err).was_called(1); |
201 assert.spy(cb2_err).was_called_with("foo"); | 201 assert.spy(cb2_err).was_called_with("foo"); |
202 end); | 202 end); |
203 | 203 |