@@ -665,25 +665,30 @@ describe('generateProjectSvg', () => {
665665 expect ( content ) . toContain ( '#71C277' ) ;
666666 } ) ;
667667
668- it ( 'omits the translation bar when approvalProgress is 100' , ( ) => {
669- const entries = [ makeEntry ( { translationProgress : 100 , approvalProgress : 100 } ) ] ;
670- generateProjectSvg ( 'Proj' , entries , SVG_TEST_OUT ) ;
671- const [ , content ] = fs . writeFileSync . mock . calls [ 0 ] ;
672- expect ( content ) . not . toContain ( '#5D89C3' ) ;
673- } ) ;
674-
675- it ( 'omits background track when translationProgress is 100' , ( ) => {
676- const entries = [ makeEntry ( { translationProgress : 100 , approvalProgress : 50 } ) ] ;
677- generateProjectSvg ( 'Proj' , entries , SVG_TEST_OUT ) ;
678- const [ , content ] = fs . writeFileSync . mock . calls [ 0 ] ;
679- expect ( content ) . not . toContain ( 'opacity="0.3"' ) ;
680- } ) ;
681-
682- it ( 'omits approval bar when approvalProgress is 0' , ( ) => {
683- const entries = [ makeEntry ( { translationProgress : 50 , approvalProgress : 0 } ) ] ;
668+ it . each ( [
669+ {
670+ name : 'omits the translation bar when approvalProgress is 100' ,
671+ translationProgress : 100 ,
672+ approvalProgress : 100 ,
673+ unexpectedContent : '#5D89C3' ,
674+ } ,
675+ {
676+ name : 'omits background track when translationProgress is 100' ,
677+ translationProgress : 100 ,
678+ approvalProgress : 50 ,
679+ unexpectedContent : 'opacity="0.3"' ,
680+ } ,
681+ {
682+ name : 'omits approval bar when approvalProgress is 0' ,
683+ translationProgress : 50 ,
684+ approvalProgress : 0 ,
685+ unexpectedContent : '#71C277' ,
686+ } ,
687+ ] ) ( '$name' , ( { translationProgress, approvalProgress, unexpectedContent } ) => {
688+ const entries = [ makeEntry ( { translationProgress, approvalProgress } ) ] ;
684689 generateProjectSvg ( 'Proj' , entries , SVG_TEST_OUT ) ;
685690 const [ , content ] = fs . writeFileSync . mock . calls [ 0 ] ;
686- expect ( content ) . not . toContain ( '#71C277' ) ;
691+ expect ( content ) . not . toContain ( unexpectedContent ) ;
687692 } ) ;
688693
689694 it ( 'generates an empty SVG body when entries is empty' , ( ) => {
@@ -1671,19 +1676,13 @@ describe('main', () => {
16711676 expect ( mockPaginate ) . not . toHaveBeenCalled ( ) ;
16721677 } ) ;
16731678
1674- it ( 'still generates SVG graphs' , async ( ) => {
1675- await main ( ) ;
1676- expect ( console . log ) . toHaveBeenCalledWith ( expect . stringContaining ( 'SVG graphs' ) ) ;
1677- } ) ;
1678-
1679- it ( 'logs the SVG-only mode message' , async ( ) => {
1680- await main ( ) ;
1681- expect ( console . log ) . toHaveBeenCalledWith ( expect . stringContaining ( 'SVG-only' ) ) ;
1682- } ) ;
1683-
1684- it ( 'completes successfully without GitHub credentials' , async ( ) => {
1679+ it . each ( [
1680+ { name : 'still generates SVG graphs' , logMessage : 'SVG graphs' } ,
1681+ { name : 'logs the SVG-only mode message' , logMessage : 'SVG-only' } ,
1682+ { name : 'completes successfully without GitHub credentials' , logMessage : 'Sync complete' } ,
1683+ ] ) ( '$name' , async ( { logMessage } ) => {
16851684 await main ( ) ;
1686- expect ( console . log ) . toHaveBeenCalledWith ( expect . stringContaining ( 'Sync complete' ) ) ;
1685+ expect ( console . log ) . toHaveBeenCalledWith ( expect . stringContaining ( logMessage ) ) ;
16871686 } ) ;
16881687 } ) ;
16891688} ) ;
0 commit comments