@@ -129,7 +129,7 @@ describe('summary to markdown', () => {
129129 }
130130
131131 test ( 'should convert summary to markdown with title' , ( ) => {
132- const parsedSummary = summaryToMarkdown ( summary , options , false )
132+ const parsedSummary = summaryToMarkdown ( summary , options )
133133 expect ( parsedSummary ) . toMatchInlineSnapshot ( `
134134 "| Lines | Statements | Branches | Functions |
135135 | --- | --- | --- | --- |
@@ -139,9 +139,47 @@ describe('summary to markdown', () => {
139139 } )
140140
141141 test ( 'should convert summary to markdown without title' , ( ) => {
142- const parsedSummary = summaryToMarkdown ( summary , options , true )
142+ const parsedSummary = summaryToMarkdown ( summary , options , {
143+ withoutHeader : true ,
144+ } )
143145 expect ( parsedSummary ) . toMatchInlineSnapshot (
144146 `"| <a href="https://github.com/MishaKav/jest-coverage-comment/blob/05953710b21d222efa4f4535424a7af367be5a57/README.md"><img alt="Coverage: 78%" src="https://img.shields.io/badge/Coverage-78%25-yellow.svg" /></a><br/> | 76.74% (33/43) | 100% (0/0) | 33.33% (2/6) |"`
145147 )
146148 } )
149+
150+ test ( 'should convert summary to markdown with positive coverage change' , ( ) => {
151+ const parsedSummary = summaryToMarkdown ( summary , options , {
152+ previousCoverage : '70' ,
153+ } )
154+ expect ( parsedSummary ) . toMatchInlineSnapshot ( `
155+ "| Lines | Statements | Branches | Functions |
156+ | --- | --- | --- | --- |
157+ | <a href="https://github.com/MishaKav/jest-coverage-comment/blob/05953710b21d222efa4f4535424a7af367be5a57/README.md"><img alt="Coverage: 78%" src="https://img.shields.io/badge/Coverage-78%25-yellow.svg" /></a><br/>▲ Increased (+8%) | 76.74% (33/43) | 100% (0/0) | 33.33% (2/6) |
158+ "
159+ ` )
160+ } )
161+
162+ test ( 'should convert summary to markdown with negative coverage change' , ( ) => {
163+ const parsedSummary = summaryToMarkdown ( summary , options , {
164+ previousCoverage : '90' ,
165+ } )
166+ expect ( parsedSummary ) . toMatchInlineSnapshot ( `
167+ "| Lines | Statements | Branches | Functions |
168+ | --- | --- | --- | --- |
169+ | <a href="https://github.com/MishaKav/jest-coverage-comment/blob/05953710b21d222efa4f4535424a7af367be5a57/README.md"><img alt="Coverage: 78%" src="https://img.shields.io/badge/Coverage-78%25-yellow.svg" /></a><br/>▼ Decreased (-12%) | 76.74% (33/43) | 100% (0/0) | 33.33% (2/6) |
170+ "
171+ ` )
172+ } )
173+
174+ test ( 'should convert summary to markdown without coverage change on wrong value' , ( ) => {
175+ const parsedSummary = summaryToMarkdown ( summary , options , {
176+ previousCoverage : 'test' ,
177+ } )
178+ expect ( parsedSummary ) . toMatchInlineSnapshot ( `
179+ "| Lines | Statements | Branches | Functions |
180+ | --- | --- | --- | --- |
181+ | <a href="https://github.com/MishaKav/jest-coverage-comment/blob/05953710b21d222efa4f4535424a7af367be5a57/README.md"><img alt="Coverage: 78%" src="https://img.shields.io/badge/Coverage-78%25-yellow.svg" /></a><br/> | 76.74% (33/43) | 100% (0/0) | 33.33% (2/6) |
182+ "
183+ ` )
184+ } )
147185} )
0 commit comments