File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ import test from 'ava' ;
2
+ import lint from './lint' ;
3
+
4
+ test ( 'throws without params' , t => {
5
+ t . throws ( ( ) => lint ( ) ) ;
6
+ } ) ;
7
+
8
+ test ( 'throws with empty message' , t => {
9
+ t . throws ( ( ) => lint ( '' ) ) ;
10
+ } ) ;
11
+
12
+ test ( 'positive on stub message and no rule' , t => {
13
+ const actual = lint ( 'foo: bar' ) ;
14
+ t . true ( actual . valid ) ;
15
+ } ) ;
16
+
17
+ test ( 'positive on stub message and adhered rule' , t => {
18
+ const actual = lint ( 'foo: bar' , {
19
+ 'type-enum' : [ 2 , 'always' , [ 'foo' ] ]
20
+ } ) ;
21
+ t . true ( actual . valid ) ;
22
+ } ) ;
23
+
24
+ test ( 'negative on stub message and broken rule' , t => {
25
+ const actual = lint ( 'foo: bar' , {
26
+ 'type-enum' : [ 2 , 'never' , [ 'foo' ] ]
27
+ } ) ;
28
+ t . false ( actual . valid ) ;
29
+ } ) ;
30
+
31
+ test ( 'positive on ignored message and broken rule' , t => {
32
+ const actual = lint ( 'Revert "some bogus commit"' , {
33
+ 'type-empty' : [ 2 , 'never' ]
34
+ } ) ;
35
+ t . true ( actual . valid ) ;
36
+ } ) ;
You can’t perform that action at this time.
0 commit comments