Skip to content

Commit

Permalink
tests: simplify verfy option throw test
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Jun 20, 2016
1 parent d2cdae7 commit 74d5ab5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 48 deletions.
16 changes: 4 additions & 12 deletions test/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,18 +312,10 @@ describe('bodyParser.json()', function(){
})
})

describe('with verify option', function(){
it('should assert value if function', function(){
var err;

try {
var server = createServer({ verify: 'lol' })
} catch (e) {
err = e;
}

assert.ok(err);
assert.equal(err.name, 'TypeError');
describe('with verify option', function () {
it('should assert value if function', function () {
assert.throws(createServer.bind(null, { verify: 'lol' }),
/TypeError: option verify must be function/)
})

it('should error from verify', function(done){
Expand Down
16 changes: 4 additions & 12 deletions test/raw.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,18 +228,10 @@ describe('bodyParser.raw()', function(){
})
})

describe('with verify option', function(){
it('should assert value is function', function(){
var err;

try {
var server = createServer({ verify: 'lol' })
} catch (e) {
err = e;
}

assert.ok(err);
assert.equal(err.name, 'TypeError');
describe('with verify option', function () {
it('should assert value is function', function () {
assert.throws(createServer.bind(null, { verify: 'lol' }),
/TypeError: option verify must be function/)
})

it('should error from verify', function(done){
Expand Down
16 changes: 4 additions & 12 deletions test/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,18 +256,10 @@ describe('bodyParser.text()', function(){
})
})

describe('with verify option', function(){
it('should assert value is function', function(){
var err;

try {
var server = createServer({ verify: 'lol' })
} catch (e) {
err = e;
}

assert.ok(err);
assert.equal(err.name, 'TypeError');
describe('with verify option', function () {
it('should assert value is function', function () {
assert.throws(createServer.bind(null, { verify: 'lol' }),
/TypeError: option verify must be function/)
})

it('should error from verify', function(done){
Expand Down
16 changes: 4 additions & 12 deletions test/urlencoded.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,18 +480,10 @@ describe('bodyParser.urlencoded()', function(){
})
})

describe('with verify option', function(){
it('should assert value if function', function(){
var err;

try {
var server = createServer({ verify: 'lol' })
} catch (e) {
err = e;
}

assert.ok(err);
assert.equal(err.name, 'TypeError');
describe('with verify option', function () {
it('should assert value if function', function () {
assert.throws(createServer.bind(null, { verify: 'lol' }),
/TypeError: option verify must be function/)
})

it('should error from verify', function(done){
Expand Down

0 comments on commit 74d5ab5

Please sign in to comment.