@@ -7,7 +7,7 @@ import java.util.UUID
77import com .gu .mobile .notifications .client .models .Importance .{Major , Minor }
88import com .gu .mobile .notifications .client .models ._
99import com .gu .mobile .notifications .football .lib .SyntheticMatchEventGenerator
10- import com .gu .mobile .notifications .football .models .{Dismissal , FootballMatchEvent , Goal , GoalContext , Score }
10+ import com .gu .mobile .notifications .football .models .{Dismissal , FootballMatchEvent , Goal , GoalContext , KickOff , Score }
1111import org .specs2 .mutable .Specification
1212import org .specs2 .specification .Scope
1313import pa .{Competition , MatchDay , MatchDayTeam , Parser , Round , Stage , Venue }
@@ -49,11 +49,30 @@ class MatchStatusNotificationBuilderSpec extends Specification {
4949 matchStatus = " 1st" ,
5050 kickOffTimestamp = Some (ZonedDateTime .parse(" 2000-01-01T00:00:00Z" ).toEpochSecond),
5151 lineupsAvailable = Some (false ),
52+ detailedMatchStatus = Some (" FIRST_HALF" ),
5253 debug = false ,
5354 dryRun = None
5455 )
5556 }
5657
58+ " Include detailedMatchStatus derived from triggering event type" in new MatchEventsContext {
59+ val kickOff = KickOff (" " )
60+ val notification = builder.build(kickOff, matchInfo.copy(matchStatus = " Fixture" ), List .empty, None )
61+ notification.detailedMatchStatus shouldEqual Some (" FIRST_HALF" )
62+ }
63+
64+ " Include detailedMatchStatus from PA status when event type has no override" in new MatchEventsContext {
65+ val matchInPenalties = matchInfo.copy(matchStatus = " PT" )
66+ val notification = builder.build(baseGoal, matchInPenalties, List .empty, None )
67+ notification.detailedMatchStatus shouldEqual Some (" PENALTIES" )
68+ }
69+
70+ " Include detailedMatchStatus for extra time half time" in new MatchEventsContext {
71+ val matchInETHT = matchInfo.copy(matchStatus = " ETHT" )
72+ val notification = builder.build(baseGoal, matchInETHT, List .empty, None )
73+ notification.detailedMatchStatus shouldEqual Some (" EXTRA_TIME_HALF_TIME" )
74+ }
75+
5776 " Include lineupsAvailable from matchInfo when false" in new MatchEventsContext {
5877 val notification = builder.build(baseGoal, matchInfo, List .empty, None )
5978 notification.lineupsAvailable shouldEqual Some (false )
@@ -110,7 +129,7 @@ class MatchStatusNotificationBuilderSpec extends Specification {
110129 previewAvailable = false ,
111130 reportAvailable = false ,
112131 lineupsAvailable = false ,
113- matchStatus = " 1st " ,
132+ matchStatus = " KO " ,
114133 attendance = None ,
115134 homeTeam = home,
116135 awayTeam = away,
0 commit comments