Skip to content

Commit df22d5c

Browse files
committed
chore: clean up the test format
1 parent 622bf1b commit df22d5c

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

Conversions/test/RgbHslConversion.test.js

+7-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { rgbToHsl } from '../RgbHslConversion'
22
describe('RgbHslConversion', () => {
3-
const validTestCases = [
3+
test.each([
44
[
55
[215, 19, 180],
66
[311, 84, 46]
@@ -29,23 +29,18 @@ describe('RgbHslConversion', () => {
2929
[255, 255, 255],
3030
[0, 0, 100]
3131
]
32-
]
33-
34-
const errorTestCases = [
35-
[[256, 180, 9], 'Input is not a valid RGB color.'],
36-
[[-90, 46, 8], 'Input is not a valid RGB color.'],
37-
[[1, 39, 900], 'Input is not a valid RGB color.']
38-
]
39-
40-
41-
test.each(validTestCases)(
32+
])(
4233
'Should return the color in HSL format.',
4334
(colorRgb, expected) => {
4435
expect(rgbToHsl(colorRgb)).toEqual(expected)
4536
}
4637
)
4738

48-
test.each(errorTestCases)(
39+
test.each([
40+
[[256, 180, 9], 'Input is not a valid RGB color.'],
41+
[[-90, 46, 8], 'Input is not a valid RGB color.'],
42+
[[1, 39, 900], 'Input is not a valid RGB color.']
43+
])(
4944
'Should return the error message.',
5045
(colorRgb, expected) => {
5146
expect(() => rgbToHsl(colorRgb)).toThrowError(expected)

0 commit comments

Comments
 (0)