Skip to content

Commit 39fe571

Browse files
committed
Test coverage corner case
1 parent 3dc51f4 commit 39fe571

File tree

5 files changed

+25
-0
lines changed

5 files changed

+25
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
},
3131
"devDependencies": {
3232
"chai": "^3.5.0",
33+
"chai-as-promised": "^7.1.1",
3334
"coveralls": "^3.0.0",
3435
"eslint": "^4.17.0",
3536
"eslint-config-airbnb": "^16.1.0",

test/.mocha-opts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--require test/setup.js
2+
--recursive
3+
--ui bdd

test/integration/commands/common.spec.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,11 @@ describe('Commands - Common', function () {
4747
assert.equal(status, true);
4848
});
4949
});
50+
51+
describe('test rejection', function () {
52+
it('should reject promise on throw', async () => {
53+
let promise = redisClient.set('hello');
54+
assert.isRejected(promise, Error);
55+
});
56+
});
5057
});

test/setup.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
const chai = require('chai');
2+
const chaiAsPromise = require('chai-as-promised');
3+
4+
chai.use(chaiAsPromise);

yarn.lock

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,12 @@ center-align@^0.1.1:
348348
align-text "^0.1.3"
349349
lazy-cache "^1.0.3"
350350

351+
chai-as-promised@^7.1.1:
352+
version "7.1.1"
353+
resolved "https://registry.yarnpkg.com/chai-as-promised/-/chai-as-promised-7.1.1.tgz#08645d825deb8696ee61725dbf590c012eb00ca0"
354+
dependencies:
355+
check-error "^1.0.2"
356+
351357
chai@^3.5.0:
352358
version "3.5.0"
353359
resolved "https://registry.yarnpkg.com/chai/-/chai-3.5.0.tgz#4d02637b067fe958bdbfdd3a40ec56fef7373247"
@@ -378,6 +384,10 @@ chardet@^0.4.0:
378384
version "0.4.2"
379385
resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2"
380386

387+
check-error@^1.0.2:
388+
version "1.0.2"
389+
resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82"
390+
381391
circular-json@^0.3.1:
382392
version "0.3.3"
383393
resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66"

0 commit comments

Comments
 (0)