11import assert from 'node:assert/strict' ;
2- import { describe as nodeDescribe , it as nodeIt } from 'node:test' ;
2+ import { describe , it } from 'node:test' ;
33import { footballData } from '../fixtures/generated/football-live' ;
44import {
55 emptyMatches ,
@@ -27,8 +27,8 @@ const withMatches = (
2727 } ) ) ,
2828 } ) ) ;
2929
30- void nodeDescribe ( 'footballMatches' , ( ) => {
31- void nodeIt ( 'should parse match fixtures correctly' , ( ) => {
30+ void describe ( 'footballMatches' , ( ) => {
31+ void it ( 'should parse match fixtures correctly' , ( ) => {
3232 const result = parse ( footballData . matchesList ) . getOrThrow (
3333 'Expected football match parsing to succeed' ,
3434 ) ;
@@ -45,75 +45,66 @@ void nodeDescribe('footballMatches', () => {
4545 assert . equal ( competition ?. tag , 'football/serieafootball' ) ;
4646 } ) ;
4747
48- void nodeIt (
49- 'should return an error when football days have invalid dates' ,
50- ( ) => {
51- const invalidDate : FEMatchByDateAndCompetition [ ] = emptyMatches . map (
52- ( day ) => ( {
53- ...day ,
54- date : 'foo' ,
55- } ) ,
56- ) ;
57-
58- const result = parse ( invalidDate ) . getErrorOrThrow (
59- 'Expected football match parsing to fail' ,
60- ) ;
61-
62- assert . equal ( result . kind , 'FootballDayInvalidDate' ) ;
63- } ,
64- ) ;
65-
66- void nodeIt (
67- 'should return an error when football matches have an invalid date' ,
68- ( ) => {
69- const invalidMatchResult : FEMatchByDateAndCompetition [ ] =
70- withMatches ( [
71- matchFixture ,
72- { ...matchResult , date : '' } ,
73- matchDayLive ,
74- ] ) ;
75- const invalidMatchFixture : FEMatchByDateAndCompetition [ ] =
76- withMatches ( [
77- { ...matchFixture , date : '' } ,
78- matchResult ,
79- matchDayLive ,
80- ] ) ;
81- const invalidLiveMatch : FEMatchByDateAndCompetition [ ] = withMatches (
82- [ matchResult , matchFixture , { ...matchDayLive , date : '' } ] ,
83- ) ;
84-
85- const resultOne = parse ( invalidMatchResult ) . getErrorOrThrow (
86- 'Expected football match parsing to fail' ,
87- ) ;
88- const resultTwo = parse ( invalidMatchFixture ) . getErrorOrThrow (
89- 'Expected football match parsing to fail' ,
90- ) ;
91- const resultThree = parse ( invalidLiveMatch ) . getErrorOrThrow (
92- 'Expected football match parsing to fail' ,
93- ) ;
94-
95- assert . equal ( resultOne . kind , 'FootballMatchInvalidDate' ) ;
96- assert . equal ( resultTwo . kind , 'FootballMatchInvalidDate' ) ;
97-
98- if ( resultThree . kind !== 'InvalidMatchDay' ) {
99- throw new Error ( 'Expected an invalid match day error' ) ;
100- }
48+ void it ( 'should return an error when football days have invalid dates' , ( ) => {
49+ const invalidDate : FEMatchByDateAndCompetition [ ] = emptyMatches . map (
50+ ( day ) => ( {
51+ ...day ,
52+ date : 'foo' ,
53+ } ) ,
54+ ) ;
55+
56+ const result = parse ( invalidDate ) . getErrorOrThrow (
57+ 'Expected football match parsing to fail' ,
58+ ) ;
59+
60+ assert . equal ( result . kind , 'FootballDayInvalidDate' ) ;
61+ } ) ;
62+
63+ void it ( 'should return an error when football matches have an invalid date' , ( ) => {
64+ const invalidMatchResult : FEMatchByDateAndCompetition [ ] = withMatches ( [
65+ matchFixture ,
66+ { ...matchResult , date : '' } ,
67+ matchDayLive ,
68+ ] ) ;
69+ const invalidMatchFixture : FEMatchByDateAndCompetition [ ] = withMatches ( [
70+ { ...matchFixture , date : '' } ,
71+ matchResult ,
72+ matchDayLive ,
73+ ] ) ;
74+ const invalidLiveMatch : FEMatchByDateAndCompetition [ ] = withMatches ( [
75+ matchResult ,
76+ matchFixture ,
77+ { ...matchDayLive , date : '' } ,
78+ ] ) ;
79+
80+ const resultOne = parse ( invalidMatchResult ) . getErrorOrThrow (
81+ 'Expected football match parsing to fail' ,
82+ ) ;
83+ const resultTwo = parse ( invalidMatchFixture ) . getErrorOrThrow (
84+ 'Expected football match parsing to fail' ,
85+ ) ;
86+ const resultThree = parse ( invalidLiveMatch ) . getErrorOrThrow (
87+ 'Expected football match parsing to fail' ,
88+ ) ;
10189
102- assert . equal (
103- resultThree . errors [ 0 ] ! . kind ,
104- 'FootballMatchInvalidDate' ,
105- ) ;
106- } ,
107- ) ;
90+ assert . equal ( resultOne . kind , 'FootballMatchInvalidDate' ) ;
91+ assert . equal ( resultTwo . kind , 'FootballMatchInvalidDate' ) ;
92+
93+ if ( resultThree . kind !== 'InvalidMatchDay' ) {
94+ throw new Error ( 'Expected an invalid match day error' ) ;
95+ }
10896
109- void nodeIt ( 'should return an error when it receives a live match' , ( ) => {
97+ assert . equal ( resultThree . errors [ 0 ] ! . kind , 'FootballMatchInvalidDate' ) ;
98+ } ) ;
99+
100+ void it ( 'should return an error when it receives a live match' , ( ) => {
110101 const result = parse ( withMatches ( [ liveMatch ] ) ) . getErrorOrThrow (
111102 'Expected football match parsing to fail' ,
112103 ) ;
113104
114105 assert . equal ( result . kind , 'UnexpectedLiveMatch' ) ;
115106 } ) ;
116- void nodeIt ( 'should return a clean team name' , ( ) => {
107+ void it ( 'should return a clean team name' , ( ) => {
117108 const matchesListWithTeamName = ( teamName : string ) : FEResult => {
118109 return {
119110 ...matchResult ,
@@ -150,39 +141,33 @@ void nodeDescribe('footballMatches', () => {
150141 assert . equal ( match . homeTeam . name , cleanName ) ;
151142 }
152143 } ) ;
153- void nodeIt (
154- 'should replace known live match status with our status' ,
155- ( ) => {
156- const matchDay = parse (
157- withMatches ( [ matchDayLiveSecondHalf ] ) ,
158- ) . getOrThrow ( 'Expected football live match parsing to succeed' ) ;
159-
160- const match = matchDay [ 0 ] ! . competitions [ 0 ] ! . matches [ 0 ] ;
161- if ( match ?. kind !== 'Live' ) {
162- throw new Error ( 'Expected live match' ) ;
163- }
144+ void it ( 'should replace known live match status with our status' , ( ) => {
145+ const matchDay = parse (
146+ withMatches ( [ matchDayLiveSecondHalf ] ) ,
147+ ) . getOrThrow ( 'Expected football live match parsing to succeed' ) ;
148+
149+ const match = matchDay [ 0 ] ! . competitions [ 0 ] ! . matches [ 0 ] ;
150+ if ( match ?. kind !== 'Live' ) {
151+ throw new Error ( 'Expected live match' ) ;
152+ }
164153
165- assert . equal ( match . status , '2nd' ) ;
166- } ,
167- ) ;
168- void nodeIt (
169- 'should replace unknown live match status with first two characters' ,
170- ( ) => {
171- const matchDayLiveUnknownStatus = {
172- ...matchDayLiveSecondHalf ,
173- matchStatus : 'Something odd' ,
174- } ;
154+ assert . equal ( match . status , '2nd' ) ;
155+ } ) ;
156+ void it ( 'should replace unknown live match status with first two characters' , ( ) => {
157+ const matchDayLiveUnknownStatus = {
158+ ...matchDayLiveSecondHalf ,
159+ matchStatus : 'Something odd' ,
160+ } ;
175161
176- const matchDay = parse (
177- withMatches ( [ matchDayLiveUnknownStatus ] ) ,
178- ) . getOrThrow ( 'Expected football live match parsing to succeed' ) ;
162+ const matchDay = parse (
163+ withMatches ( [ matchDayLiveUnknownStatus ] ) ,
164+ ) . getOrThrow ( 'Expected football live match parsing to succeed' ) ;
179165
180- const match = matchDay [ 0 ] ! . competitions [ 0 ] ! . matches [ 0 ] ;
181- if ( match ?. kind !== 'Live' ) {
182- throw new Error ( 'Expected live match' ) ;
183- }
166+ const match = matchDay [ 0 ] ! . competitions [ 0 ] ! . matches [ 0 ] ;
167+ if ( match ?. kind !== 'Live' ) {
168+ throw new Error ( 'Expected live match' ) ;
169+ }
184170
185- assert . equal ( match . status , 'So' ) ;
186- } ,
187- ) ;
171+ assert . equal ( match . status , 'So' ) ;
172+ } ) ;
188173} ) ;
0 commit comments