Skip to content

Commit 6d89b8b

Browse files
committed
Force rest parameter on first test
1 parent 564aca4 commit 6d89b8b

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

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

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,19 @@ function list(...values) {
5252

5353
describe('getListOfWagons', () => {
5454
test('returns the correct array', () => {
55-
expect(getListOfWagons(1, 5, 2, 7, 4)).toEqual([1, 5, 2, 7, 4]);
55+
expect(getListOfWagons(1, 5, 2, 7, 4)).toStrictEqual([1, 5, 2, 7, 4]);
5656
});
5757

5858
test('works for a few arguments', () => {
59-
expect(getListOfWagons(1, 5)).toEqual([1, 5]);
59+
expect(getListOfWagons(1, 5)).toStrictEqual([1, 5]);
6060
});
6161

6262
test('works for a one argument', () => {
63-
expect(getListOfWagons(1)).toEqual([1]);
63+
expect(getListOfWagons(1)).toStrictEqual([1]);
6464
});
6565

6666
test('works for many arguments', () => {
67-
expect(getListOfWagons(1, 5, 6, 3, 9, 8, 4, 14, 24, 7)).toEqual([
67+
expect(getListOfWagons(1, 5, 6, 3, 9, 8, 4, 14, 24, 7)).toStrictEqual([
6868
1, 5, 6, 3, 9, 8, 4, 14, 24, 7,
6969
]);
7070
});
@@ -75,19 +75,19 @@ describe('fixListOfWagons', () => {
7575
const eachWagonsID = list(3, 7, 1, 14, 10, 4, 12, 6, 23, 17, 13, 20, 8, 19);
7676
const expected = [1, 14, 10, 4, 12, 6, 23, 17, 13, 20, 8, 19, 3, 7];
7777

78-
expect(fixListOfWagons(eachWagonsID)).toEqual(expected);
78+
expect(fixListOfWagons(eachWagonsID)).toStrictEqual(expected);
7979
});
8080

8181
test('works when only 3 wagons given', () => {
8282
const eachWagonsID = list(4, 2, 1);
8383

84-
expect(fixListOfWagons(eachWagonsID)).toEqual([1, 4, 2]);
84+
expect(fixListOfWagons(eachWagonsID)).toStrictEqual([1, 4, 2]);
8585
});
8686

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

90-
expect(fixListOfWagons(eachWagonsID)).toEqual([1, 5, 7, 9, 10, 3, 4]);
90+
expect(fixListOfWagons(eachWagonsID)).toStrictEqual([1, 5, 7, 9, 10, 3, 4]);
9191
});
9292
});
9393

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

102-
expect(correctListOfWagons(eachWagonsID, missingWagons)).toEqual(expected);
102+
expect(correctListOfWagons(eachWagonsID, missingWagons)).toStrictEqual(
103+
expected,
104+
);
103105
});
104106

105107
test('works for short arrays', () => {
106108
const eachWagonsID = list(1, 7, 15, 24);
107109
const missingWagons = list(8, 6, 4);
108110
const expected = [1, 8, 6, 4, 7, 15, 24];
109111

110-
expect(correctListOfWagons(eachWagonsID, missingWagons)).toEqual(expected);
112+
expect(correctListOfWagons(eachWagonsID, missingWagons)).toStrictEqual(
113+
expected,
114+
);
111115
});
112116

113117
test('works when missingWagons is longer', () => {
114118
const eachWagonsID = list(1, 7, 15, 24);
115119
const missingWagons = list(8, 6, 4, 5, 9, 21, 2, 13);
116120
const expected = [1, 8, 6, 4, 5, 9, 21, 2, 13, 7, 15, 24];
117121

118-
expect(correctListOfWagons(eachWagonsID, missingWagons)).toEqual(expected);
122+
expect(correctListOfWagons(eachWagonsID, missingWagons)).toStrictEqual(
123+
expected,
124+
);
119125
});
120126
});
121127

@@ -136,7 +142,7 @@ describe('extendRouteInformation', () => {
136142
temperature: '5',
137143
};
138144

139-
expect(extendRouteInformation(route, moreRouteInformation)).toEqual(
145+
expect(extendRouteInformation(route, moreRouteInformation)).toStrictEqual(
140146
expected,
141147
);
142148
});
@@ -152,7 +158,7 @@ describe('extendRouteInformation', () => {
152158
temperature: '20',
153159
};
154160

155-
expect(extendRouteInformation(route, moreRouteInformation)).toEqual(
161+
expect(extendRouteInformation(route, moreRouteInformation)).toStrictEqual(
156162
expected,
157163
);
158164
});
@@ -173,7 +179,7 @@ describe('extendRouteInformation', () => {
173179
temperature: '-6',
174180
};
175181

176-
expect(extendRouteInformation(route, moreRouteInformation)).toEqual(
182+
expect(extendRouteInformation(route, moreRouteInformation)).toStrictEqual(
177183
expected,
178184
);
179185
});
@@ -194,7 +200,7 @@ describe('separateTimeOfArrival', () => {
194200
{ from: 'Berlin', to: 'Hamburg', precipitation: '10', temperature: '5' },
195201
];
196202

197-
expect(separateTimeOfArrival(route)).toEqual(expected);
203+
expect(separateTimeOfArrival(route)).toStrictEqual(expected);
198204
});
199205

200206
test('separates timeOfArrival with smaller object', () => {
@@ -210,7 +216,7 @@ describe('separateTimeOfArrival', () => {
210216
{ from: 'Paris', to: 'London', temperature: '20' },
211217
];
212218

213-
expect(separateTimeOfArrival(route)).toEqual(expected);
219+
expect(separateTimeOfArrival(route)).toStrictEqual(expected);
214220
});
215221

216222
test('separates timeOfArrival from differently ordered object', () => {
@@ -232,6 +238,6 @@ describe('separateTimeOfArrival', () => {
232238
},
233239
];
234240

235-
expect(separateTimeOfArrival(route)).toEqual(expected);
241+
expect(separateTimeOfArrival(route)).toStrictEqual(expected);
236242
});
237243
});

0 commit comments

Comments
 (0)