Skip to content

Commit 6a4e329

Browse files
author
Ruben Bridgewater
committed
Add error tests
1 parent faa9aec commit 6a4e329

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"scripts": {
77
"test": "npm run coverage",
88
"benchmark": "node ./benchmark",
9-
"posttest": "standard && npm run coverage:check",
9+
"lint": "standard --fix",
10+
"posttest": "npm run lint && npm run coverage:check",
1011
"coverage": "node ./node_modules/istanbul/lib/cli.js cover --preserve-comments ./node_modules/mocha/bin/_mocha -- -R spec",
1112
"coverage:check": "node ./node_modules/istanbul/lib/cli.js check-coverage --branch 100 --statement 100"
1213
},

test/errors.spec.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict'
2+
3+
/* eslint-env mocha */
4+
5+
var assert = require('assert')
6+
var ReplyError = require('../lib/replyError')
7+
var ParserError = require('../lib/parserError')
8+
var RedisError = require('../lib/redisError')
9+
10+
describe('errors', function () {
11+
it('errors should have a stack trace with error message', function () {
12+
var err1 = new RedisError('test')
13+
var err2 = new ReplyError('test')
14+
var err3 = new ParserError('test', new Buffer(''), 0)
15+
assert(err1.stack)
16+
assert(err2.stack)
17+
assert(err3.stack)
18+
assert(/RedisError: test/.test(err1.stack))
19+
assert(/ReplyError: test/.test(err2.stack))
20+
assert(/ParserError: test/.test(err3.stack))
21+
})
22+
})

0 commit comments

Comments
 (0)