Skip to content

Commit 8b24965

Browse files
Force rest parameter on first test (#2673)
1 parent 70e9901 commit 8b24965

1 file changed

Lines changed: 22 additions & 16 deletions

File tree

exercises/concept/train-driver/train-driver.spec.js

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,19 @@ function time(timeOfArrival, route) {
6363

6464
describe('getListOfWagons', () => {
6565
test('returns the correct array', () => {
66-
expect(getListOfWagons(1, 5, 2, 7, 4)).toEqual([1, 5, 2, 7, 4]);
66+
expect(getListOfWagons(1, 5, 2, 7, 4)).toStrictEqual([1, 5, 2, 7, 4]);
6767
});
6868

6969
test('works for a few arguments', () => {
70-
expect(getListOfWagons(1, 5)).toEqual([1, 5]);
70+
expect(getListOfWagons(1, 5)).toStrictEqual([1, 5]);
7171
});
7272

7373
test('works for a one argument', () => {
74-
expect(getListOfWagons(1)).toEqual([1]);
74+
expect(getListOfWagons(1)).toStrictEqual([1]);
7575
});
7676

7777
test('works for many arguments', () => {
78-
expect(getListOfWagons(1, 5, 6, 3, 9, 8, 4, 14, 24, 7)).toEqual([
78+
expect(getListOfWagons(1, 5, 6, 3, 9, 8, 4, 14, 24, 7)).toStrictEqual([
7979
1, 5, 6, 3, 9, 8, 4, 14, 24, 7,
8080
]);
8181
});
@@ -86,19 +86,19 @@ describe('fixListOfWagons', () => {
8686
const eachWagonsID = list(3, 7, 1, 14, 10, 4, 12, 6, 23, 17, 13, 20, 8, 19);
8787
const expected = [1, 14, 10, 4, 12, 6, 23, 17, 13, 20, 8, 19, 3, 7];
8888

89-
expect(fixListOfWagons(eachWagonsID)).toEqual(expected);
89+
expect(fixListOfWagons(eachWagonsID)).toStrictEqual(expected);
9090
});
9191

9292
test('works when only 3 wagons given', () => {
9393
const eachWagonsID = list(4, 2, 1);
9494

95-
expect(fixListOfWagons(eachWagonsID)).toEqual([1, 4, 2]);
95+
expect(fixListOfWagons(eachWagonsID)).toStrictEqual([1, 4, 2]);
9696
});
9797

9898
test('works for a few wagons', () => {
9999
const eachWagonsID = list(3, 4, 1, 5, 7, 9, 10);
100100

101-
expect(fixListOfWagons(eachWagonsID)).toEqual([1, 5, 7, 9, 10, 3, 4]);
101+
expect(fixListOfWagons(eachWagonsID)).toStrictEqual([1, 5, 7, 9, 10, 3, 4]);
102102
});
103103
});
104104

@@ -110,23 +110,29 @@ describe('correctListOfWagons', () => {
110110
1, 8, 10, 5, 9, 3, 7, 20, 6, 11, 15, 13, 14, 17, 22, 2, 16, 19, 21,
111111
];
112112

113-
expect(correctListOfWagons(eachWagonsID, missingWagons)).toEqual(expected);
113+
expect(correctListOfWagons(eachWagonsID, missingWagons)).toStrictEqual(
114+
expected,
115+
);
114116
});
115117

116118
test('works for short arrays', () => {
117119
const eachWagonsID = list(1, 7, 15, 24);
118120
const missingWagons = list(8, 6, 4);
119121
const expected = [1, 8, 6, 4, 7, 15, 24];
120122

121-
expect(correctListOfWagons(eachWagonsID, missingWagons)).toEqual(expected);
123+
expect(correctListOfWagons(eachWagonsID, missingWagons)).toStrictEqual(
124+
expected,
125+
);
122126
});
123127

124128
test('works when missingWagons is longer', () => {
125129
const eachWagonsID = list(1, 7, 15, 24);
126130
const missingWagons = list(8, 6, 4, 5, 9, 21, 2, 13);
127131
const expected = [1, 8, 6, 4, 5, 9, 21, 2, 13, 7, 15, 24];
128132

129-
expect(correctListOfWagons(eachWagonsID, missingWagons)).toEqual(expected);
133+
expect(correctListOfWagons(eachWagonsID, missingWagons)).toStrictEqual(
134+
expected,
135+
);
130136
});
131137
});
132138

@@ -147,7 +153,7 @@ describe('extendRouteInformation', () => {
147153
temperature: '5',
148154
};
149155

150-
expect(extendRouteInformation(route, moreRouteInformation)).toEqual(
156+
expect(extendRouteInformation(route, moreRouteInformation)).toStrictEqual(
151157
expected,
152158
);
153159
});
@@ -163,7 +169,7 @@ describe('extendRouteInformation', () => {
163169
temperature: '20',
164170
};
165171

166-
expect(extendRouteInformation(route, moreRouteInformation)).toEqual(
172+
expect(extendRouteInformation(route, moreRouteInformation)).toStrictEqual(
167173
expected,
168174
);
169175
});
@@ -184,7 +190,7 @@ describe('extendRouteInformation', () => {
184190
temperature: '-6',
185191
};
186192

187-
expect(extendRouteInformation(route, moreRouteInformation)).toEqual(
193+
expect(extendRouteInformation(route, moreRouteInformation)).toStrictEqual(
188194
expected,
189195
);
190196
});
@@ -204,7 +210,7 @@ describe('separateTimeOfArrival', () => {
204210
{ from: 'Berlin', to: 'Hamburg', precipitation: '10', temperature: '5' },
205211
];
206212

207-
expect(separateTimeOfArrival(route)).toEqual(expected);
213+
expect(separateTimeOfArrival(route)).toStrictEqual(expected);
208214
});
209215

210216
test('separates timeOfArrival with smaller object', () => {
@@ -219,7 +225,7 @@ describe('separateTimeOfArrival', () => {
219225
{ from: 'Paris', to: 'London', temperature: '20' },
220226
];
221227

222-
expect(separateTimeOfArrival(route)).toEqual(expected);
228+
expect(separateTimeOfArrival(route)).toStrictEqual(expected);
223229
});
224230

225231
test('separates timeOfArrival from differently ordered object', () => {
@@ -240,6 +246,6 @@ describe('separateTimeOfArrival', () => {
240246
},
241247
];
242248

243-
expect(separateTimeOfArrival(route)).toEqual(expected);
249+
expect(separateTimeOfArrival(route)).toStrictEqual(expected);
244250
});
245251
});

0 commit comments

Comments
 (0)