(type, p)
| 14 | |
| 15 | const fulfillsWith = (value, p) => p.then(v => void expect(v).to.deep.equal(value)); |
| 16 | const rejectsWith = (type, p) => { |
| 17 | const shouldReject = () => { throw new Error('Promise should have been rejected') }; |
| 18 | const reasonIs = (reason) => { if (!(reason instanceof type)) throw reason; } |
| 19 | return p.then(shouldReject, reasonIs); |
| 20 | }; |
| 21 | |
| 22 | it('should be rejected when destination is not a string', async function () { |
| 23 | await rejectsWith(TypeError, this.db.backup()); |