@@ -25,6 +25,7 @@ func Test_ReportForHuman(t *testing.T) {
2525
2626 buf := & bytes.Buffer {}
2727 ReportForHuman (buf , AnalyzeResult {Threshold : thr , TotalStats : coverage.Stats {}})
28+
2829 assertHumanReport (t , buf .String (), 3 , 0 )
2930 assertNoUncoveredLinesInfo (t , buf .String ())
3031 })
@@ -34,6 +35,7 @@ func Test_ReportForHuman(t *testing.T) {
3435
3536 buf := & bytes.Buffer {}
3637 ReportForHuman (buf , AnalyzeResult {Threshold : thr , TotalStats : coverage.Stats {Total : 1 }})
38+
3739 assertHumanReport (t , buf .String (), 2 , 1 )
3840 assertNoUncoveredLinesInfo (t , buf .String ())
3941 })
@@ -48,6 +50,7 @@ func Test_ReportForHuman(t *testing.T) {
4850 allStats := mergeStats (statsWithError , statsNoError )
4951 result := Analyze (cfg , allStats , nil )
5052 ReportForHuman (buf , result )
53+
5154 headReport , uncoveredReport := splitReport (t , buf .String ())
5255 assertHumanReport (t , headReport , 0 , 1 )
5356 assertContainStats (t , headReport , statsWithError )
@@ -70,6 +73,7 @@ func Test_ReportForHuman(t *testing.T) {
7073 allStats := mergeStats (statsWithError , statsNoError )
7174 result := Analyze (cfg , allStats , nil )
7275 ReportForHuman (buf , result )
76+
7377 headReport , uncoveredReport := splitReport (t , buf .String ())
7478 assertHumanReport (t , headReport , 0 , 1 )
7579 assertContainStats (t , headReport , MakePackageStats (statsWithError ))
@@ -83,6 +87,12 @@ func Test_ReportForHuman(t *testing.T) {
8387 coverage .StatsPluckName (coverage .StatsFilterWithCoveredLines (allStats )),
8488 )
8589 })
90+ }
91+
92+ func Test_ReportForHumanDiff (t * testing.T ) {
93+ t .Parallel ()
94+
95+ const prefix = "organization.org"
8696
8797 t .Run ("diff - no change" , func (t * testing.T ) {
8898 t .Parallel ()
@@ -94,7 +104,7 @@ func Test_ReportForHuman(t *testing.T) {
94104 result := Analyze (cfg , stats , stats )
95105 ReportForHuman (buf , result )
96106
97- assert . Contains (t , buf .String (), "No coverage changes in any files compared to the base" )
107+ assertDiffNoChange (t , buf .String ())
98108 })
99109
100110 t .Run ("diff - has change" , func (t * testing.T ) {
@@ -113,16 +123,24 @@ func Test_ReportForHuman(t *testing.T) {
113123 result := Analyze (cfg , stats , base )
114124 ReportForHuman (buf , result )
115125
116- assert .Contains (t , buf .String (),
117- "Test coverage has changed in the current files, with 2 lines missing coverage" ,
118- )
126+ assertDiffChange (t , buf .String (), 2 )
127+ })
128+
129+ t .Run ("diff - threshold failed" , func (t * testing.T ) {
130+ t .Parallel ()
131+ // add test
132+ })
133+
134+ t .Run ("diff - threshold pass" , func (t * testing.T ) {
135+ t .Parallel ()
136+ // add test
119137 })
120138}
121139
122140func Test_ReportForGithubAction (t * testing.T ) {
123141 t .Parallel ()
124142
125- prefix : = "organization.org/pkg/"
143+ const prefix = "organization.org/pkg/"
126144
127145 t .Run ("total coverage - pass" , func (t * testing.T ) {
128146 t .Parallel ()
0 commit comments