File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { from } from '@guardian/source/foundations';
44import type { SWRConfiguration } from 'swr' ;
55import { ArticleDesign , type ArticleFormat } from '../lib/articleFormat' ;
66import { useApi } from '../lib/useApi' ;
7+ import { cleanTeamName } from '../sportDataPage' ;
78import type { TeamType } from '../types/sport' ;
89import type { TagType } from '../types/tag' ;
910import { ArticleHeadline } from './ArticleHeadline' ;
@@ -138,11 +139,23 @@ export const GetMatchNav = ({
138139
139140 const isDataValid = validateMatchData ( data ) ;
140141 if ( isDataValid ) {
142+ const cleanedData = {
143+ ...data ,
144+ homeTeam : {
145+ ...data . homeTeam ,
146+ name : cleanTeamName ( data . homeTeam . name ) ,
147+ } ,
148+ awayTeam : {
149+ ...data . awayTeam ,
150+ name : cleanTeamName ( data . awayTeam . name ) ,
151+ } ,
152+ } ;
153+
141154 return (
142155 < MatchNav
143- homeTeam = { data . homeTeam }
144- awayTeam = { data . awayTeam }
145- comments = { data . comments }
156+ homeTeam = { cleanedData . homeTeam }
157+ awayTeam = { cleanedData . awayTeam }
158+ comments = { cleanedData . comments }
146159 usage = "Article"
147160 />
148161 ) ;
Original file line number Diff line number Diff line change @@ -116,6 +116,7 @@ describe('footballMatches', () => {
116116 const uncleanToCleanNames : Record < string , string > = {
117117 Ladies : '' ,
118118 Holland : 'The Netherlands' ,
119+ 'Ivory Coast' : 'Côte d’Ivoire' ,
119120 'Union Saint Gilloise' : 'Union Saint-Gilloise' ,
120121 } ;
121122
Original file line number Diff line number Diff line change @@ -81,6 +81,7 @@ export const cleanTeamName = (teamName: string): string => {
8181 return teamName
8282 . replace ( 'Ladies' , '' )
8383 . replace ( 'Holland' , 'The Netherlands' )
84+ . replace ( 'Ivory Coast' , 'Côte d’Ivoire' )
8485 . replace ( 'Bialystock' , 'Białystok' )
8586 . replace ( 'Union Saint Gilloise' , 'Union Saint-Gilloise' ) ;
8687} ;
You can’t perform that action at this time.
0 commit comments