From 557f50be7ee645082435f271e52230cd677fa39c Mon Sep 17 00:00:00 2001 From: superKalo Date: Fri, 24 Nov 2017 01:14:31 +0200 Subject: [PATCH] Add: simple test to see if the promise is rejected --- test/data-management.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/data-management.js b/test/data-management.js index 4d18cfa..cbf908e 100644 --- a/test/data-management.js +++ b/test/data-management.js @@ -165,4 +165,20 @@ describe('Data Management', () => { }); }); }); + + it('Should reject the promise', done => { + const repo = new SuperRepo({ + storage: 'LOCAL_VARIABLE', + name: 'test', + outOfDateAfter: 0, + request: () => { + return new Promise((resolve, reject) => reject('whatever')); + } + }); + + repo.getData() + .catch( () => { + expect(true).to.equal(true); + }).then(done, done); + }); });