Skip to content

Commit

Permalink
squash: use tap.throws instead of try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
lholmquist committed Aug 5, 2019
1 parent ef78ecf commit dd5ffe0
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions test/rule-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,19 @@ const BaseRule = require('../lib/rule')

test('Base Rule Test', (t) => {
t.test('No id param', (tt) => {
try {
tt.throws(() => {
new BaseRule()
tt.fail('This should fail')
} catch (err) {
tt.equal(err.message,
'Rule must have an id',
'Should have error message about id')
tt.end()
}
}, 'Rule must have an id')

tt.end()
})

t.test('No validate function', (tt) => {
try {
tt.throws(() => {
new BaseRule({id: 'test-rule'})
tt.fail('This should fail')
} catch (err) {
tt.equal(err.message,
'Rule must have validate function',
'Should have error message about validate function')
tt.end()
}
}, 'Rule must have validate function')

tt.end()
})

t.end()
Expand Down

0 comments on commit dd5ffe0

Please sign in to comment.