11import test from 'ava' ;
22import verify from '../lib/verify' ;
33
4- test . serial ( 'Verify String "changelogFile"' , t => {
4+ test . serial ( 'Verify String "changelogFile" and "chagngelogTitle" ' , t => {
55 const changelogFile = 'docs/changelog.txt' ;
6- t . notThrows ( ( ) => verify ( { changelogFile} ) ) ;
6+ const changelogTitle = '# My title here' ;
7+ t . notThrows ( ( ) => verify ( { changelogFile, changelogTitle} ) ) ;
78} ) ;
89
9- test . serial ( 'Verify undefined "changelogFile"' , t => {
10+ test . serial ( 'Verify undefined "changelogFile" and "chagngelogTitle" ' , t => {
1011 t . notThrows ( ( ) => verify ( { } ) ) ;
1112} ) ;
1213
@@ -33,3 +34,26 @@ test('Throw SemanticReleaseError if "changelogFile" option is a whitespace Strin
3334 t . is ( error . name , 'SemanticReleaseError' ) ;
3435 t . is ( error . code , 'EINVALIDCHANGELOGFILE' ) ;
3536} ) ;
37+
38+ test ( 'Throw SemanticReleaseError if "changelogTitle" option is not a String' , t => {
39+ const changelogTitle = 42 ;
40+ const [ error ] = t . throws ( ( ) => verify ( { changelogTitle} ) ) ;
41+
42+ t . is ( error . name , 'SemanticReleaseError' ) ;
43+ t . is ( error . code , 'EINVALIDCHANGELOGTITLE' ) ;
44+ } ) ;
45+
46+ test ( 'Throw SemanticReleaseError if "changelogTitle" option is an empty String' , t => {
47+ const [ error ] = t . throws ( ( ) => verify ( { changelogTitle : '' } ) ) ;
48+
49+ t . is ( error . name , 'SemanticReleaseError' ) ;
50+ t . is ( error . code , 'EINVALIDCHANGELOGTITLE' ) ;
51+ } ) ;
52+
53+ test ( 'Throw SemanticReleaseError if "changelogTitle" option is a whitespace String' , t => {
54+ const changelogTitle = ' \n \r ' ;
55+ const [ error ] = t . throws ( ( ) => verify ( { changelogTitle} ) ) ;
56+
57+ t . is ( error . name , 'SemanticReleaseError' ) ;
58+ t . is ( error . code , 'EINVALIDCHANGELOGTITLE' ) ;
59+ } ) ;
0 commit comments