1
+ import test from 'ava' ;
2
+ import parse from '../library/parse' ;
3
+ import footerContains from './footer-contains' ;
4
+
5
+ const messages = {
6
+ empty : 'foo(bar): baz' ,
7
+ matched : 'foo(bar): baz\n\nbody\n\nqux' ,
8
+ unmatched : 'foo(bar): baz\n\nbody\n\nquux'
9
+ } ;
10
+
11
+ const parsed = {
12
+ empty : parse ( messages . empty ) ,
13
+ matched : parse ( messages . matched ) ,
14
+ unmatched : parse ( messages . unmatched )
15
+ } ;
16
+
17
+ test ( 'footer-contains with no footer should not succeed' , async t => {
18
+ const [ actual ] = footerContains ( await parsed . empty , 'always' , [ ] ) ;
19
+ const expected = false ;
20
+ t . deepEqual ( actual , expected ) ;
21
+ } ) ;
22
+
23
+ test ( 'footer-contains with matching footer should succeed' , async t => {
24
+ const [ actual ] = footerContains ( await parsed . matched , 'never' , [ ] ) ;
25
+ const expected = true ;
26
+ t . deepEqual ( actual , expected ) ;
27
+ } ) ;
28
+
29
+ test ( 'footer-contains with non-matching footer should not succeed' , async t => {
30
+ const [ actual ] = footerContains ( await parsed . unmatched , 'never' , [ ] ) ;
31
+ const expected = false ;
32
+ t . deepEqual ( actual , expected ) ;
33
+ } ) ;
0 commit comments