Skip to content

Commit a9f7439

Browse files
lholmquistrichardlau
authored andcommitted
test: Add test for Rule class. (#74)
This adds two tests for the Rules class testing the error conditions for when a rule does not have an id parameter or a validate function.
1 parent ac0737b commit a9f7439

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Diff for: test/rule-test.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
'use strict'
2+
3+
const test = require('tap').test
4+
const BaseRule = require('../lib/rule')
5+
6+
test('Base Rule Test', (t) => {
7+
t.test('No id param', (tt) => {
8+
tt.throws(() => {
9+
new BaseRule()
10+
}, 'Rule must have an id')
11+
12+
tt.end()
13+
})
14+
15+
t.test('No validate function', (tt) => {
16+
tt.throws(() => {
17+
new BaseRule({id: 'test-rule'})
18+
}, 'Rule must have validate function')
19+
20+
tt.end()
21+
})
22+
23+
t.end()
24+
})

0 commit comments

Comments
 (0)