Skip to content

Commit 8368b0a

Browse files
committed
Remove node import aliases
1 parent cae6008 commit 8368b0a

54 files changed

Lines changed: 2753 additions & 3308 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { it as nodeIt } from 'node:test';
1+
import { it } from 'node:test';
22
import { parse } from 'valibot';
33
import { euParliament } from '../../../fixtures/manual/electionTrackers/euParliament';
44
import { ukGeneralExitPoll } from '../../../fixtures/manual/electionTrackers/ukGeneralExitPoll';
@@ -8,26 +8,26 @@ import { usCongressEmpty } from '../../../fixtures/manual/electionTrackers/usCon
88
import { usPresidential } from '../../../fixtures/manual/electionTrackers/usPresidential';
99
import { ElectionComponents } from './electionComponent';
1010

11-
void nodeIt('validates US Congress data', () => {
11+
void it('validates US Congress data', () => {
1212
parse(ElectionComponents, usCongressEmpty);
1313
});
1414

15-
void nodeIt('validates UK General data', () => {
15+
void it('validates UK General data', () => {
1616
parse(ElectionComponents, ukGeneralFinal);
1717
});
1818

19-
void nodeIt('validates UK General Exit Poll data', () => {
19+
void it('validates UK General Exit Poll data', () => {
2020
parse(ElectionComponents, ukGeneralExitPoll);
2121
});
2222

23-
void nodeIt('validates UK Local data', () => {
23+
void it('validates UK Local data', () => {
2424
parse(ElectionComponents, ukLocal);
2525
});
2626

27-
void nodeIt('validates US Presidential data', () => {
27+
void it('validates US Presidential data', () => {
2828
parse(ElectionComponents, usPresidential);
2929
});
3030

31-
void nodeIt('validates EU Parliament data', () => {
31+
void it('validates EU Parliament data', () => {
3232
parse(ElectionComponents, euParliament);
3333
});

dotcom-rendering/src/cricketMatch.node.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import assert from 'node:assert/strict';
2-
import { describe as nodeDescribe, it as nodeIt } from 'node:test';
2+
import { describe, it } from 'node:test';
33
import { liveMatch, resultMatch } from '../fixtures/manual/cricketMatch';
44
import { parseCricketMatch } from './cricketMatch';
55

6-
void nodeDescribe('parseCricketMatchV2', () => {
7-
void nodeIt('parses a winner result cricket match correctly', () => {
6+
void describe('parseCricketMatchV2', () => {
7+
void it('parses a winner result cricket match correctly', () => {
88
const result = parseCricketMatch(resultMatch).getOrThrow(
99
'Expected parsing cricket match to succeed',
1010
);
@@ -25,7 +25,7 @@ void nodeDescribe('parseCricketMatchV2', () => {
2525
);
2626
});
2727

28-
void nodeIt('parses a cricket match in pre-match status', () => {
28+
void it('parses a cricket match in pre-match status', () => {
2929
const result = parseCricketMatch({
3030
...liveMatch,
3131
result: 'pre-match',
@@ -36,7 +36,7 @@ void nodeDescribe('parseCricketMatchV2', () => {
3636
assert.equal(result.result, undefined);
3737
});
3838

39-
void nodeIt('parses a cricket match in in-play status', () => {
39+
void it('parses a cricket match in in-play status', () => {
4040
const result = parseCricketMatch({
4141
...liveMatch,
4242
result: 'in-play',
@@ -47,7 +47,7 @@ void nodeDescribe('parseCricketMatchV2', () => {
4747
assert.equal(result.result, undefined);
4848
});
4949

50-
void nodeIt('parses an abandoned cricket match correctly', () => {
50+
void it('parses an abandoned cricket match correctly', () => {
5151
const result = parseCricketMatch({
5252
...liveMatch,
5353
fullResult: {
@@ -63,7 +63,7 @@ void nodeDescribe('parseCricketMatchV2', () => {
6363
});
6464
});
6565

66-
void nodeIt('parses a cricket match with no winner', () => {
66+
void it('parses a cricket match with no winner', () => {
6767
const result = parseCricketMatch({
6868
...liveMatch,
6969
fullResult: {
Lines changed: 80 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import assert from 'node:assert/strict';
2-
import { describe as nodeDescribe, it as nodeIt } from 'node:test';
2+
import { describe, it } from 'node:test';
33
import { footballData } from '../fixtures/generated/football-live';
44
import {
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
});

dotcom-rendering/src/lib/acquisitions.node.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import assert from 'node:assert/strict';
2-
import { describe as nodeDescribe, it as nodeIt } from 'node:test';
2+
import { describe, it } from 'node:test';
33
import { addTrackingCodesToUrl } from './acquisitions';
44

5-
void nodeDescribe('acquisitions', () => {
6-
void nodeIt('should addTrackingCodesToUrl', () => {
5+
void describe('acquisitions', () => {
6+
void it('should addTrackingCodesToUrl', () => {
77
const result = addTrackingCodesToUrl({
88
base: `https://support.theguardian.com/contribute`,
99
componentType: 'ACQUISITIONS_HEADER',

dotcom-rendering/src/lib/ad-targeting.node.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import assert from 'node:assert/strict';
2-
import { describe as nodeDescribe, it as nodeIt } from 'node:test';
2+
import { describe, it } from 'node:test';
33
import { buildAdTargeting } from './ad-targeting';
44

55
const sharedAdTargeting = {
@@ -14,7 +14,7 @@ const sharedAdTargeting = {
1414
url: '/money/2017/mar/10/ministers-to-criminalise-use-of-ticket-tout-harvesting-software',
1515
};
1616

17-
void nodeDescribe('buildAdTargeting', () => {
17+
void describe('buildAdTargeting', () => {
1818
const expectedAdTargeting = {
1919
adUnit: '/59666047/theguardian.com/money/article/ng',
2020
customParams: {
@@ -40,7 +40,7 @@ void nodeDescribe('buildAdTargeting', () => {
4040
},
4141
};
4242

43-
void nodeIt('builds adTargeting correctly', () => {
43+
void it('builds adTargeting correctly', () => {
4444
assert.deepEqual(
4545
buildAdTargeting({
4646
isAdFreeUser: false,

0 commit comments

Comments
 (0)