You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's a helper function `rescue.all([...])` in case you want to wrap several functions with `rescue`. With `rescue.all`, doing `[rescue(fn1), rescue(fn2)]` can be shortened to `rescue.all([fn1, fn2])`.
it('Raises a TypeError if last argument is not a function',()=>{
28
-
expect(route({},{},{},{},{},{}))
29
-
.to.eventually.be.rejectedWith(TypeError,'The last parameter received by express-rescue is not a function')
28
+
returnPromise.all([
29
+
expect(route({})).to.eventually.be.rejectedWith(TypeError,'The last parameter received by express-rescue is not a function'),
30
+
expect(route({},{})).to.eventually.be.rejectedWith(TypeError,'The last parameter received by express-rescue is not a function'),
31
+
expect(route({},{},{})).to.eventually.be.rejectedWith(TypeError,'The last parameter received by express-rescue is not a function'),
32
+
expect(route({},{},{},{})).to.eventually.be.rejectedWith(TypeError,'The last parameter received by express-rescue is not a function')
33
+
])
30
34
})
31
35
32
36
it('callable(req, res, next) - works for routes and middlewares',()=>{
33
37
constspy=sinon.spy()
34
-
route({},{},spy).then(()=>{
38
+
39
+
returnroute({},{},spy).then(()=>{
35
40
expect(spy.called).to.equals(true)
36
41
})
37
42
})
38
43
39
44
it('callable(err, req, res, next) - works for error handler middlewares',()=>{
40
45
constspy=sinon.spy()
41
-
route({},{},{},spy).then(()=>{
42
-
expect(spy.called).to.equals(true)
43
-
})
44
-
})
45
46
46
-
it('callable(foo, bar, baz, foobar, foobaz, errorHandler) - should work for basically anything, since you place an error handler as the last argument',()=>{
0 commit comments