Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc0f47f0

Browse files
committed
test: add self-tests for hsl to rgb conversion algorithm
1 parentc9342e8 commitc0f47f0

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import{hslToRgb}from'../HslToRgbConversion'
2+
describe('HslToRgbConversion',()=>{
3+
test.each([
4+
[
5+
[311,84,46],
6+
[216,19,180]
7+
],
8+
[
9+
[119,83,41],
10+
[21,191,18]
11+
],
12+
[
13+
[225,33,47],
14+
[80,100,159]
15+
],
16+
[
17+
[349,98,16],
18+
[81,1,15]
19+
],
20+
[
21+
[96,100,4],
22+
[8,20,0]
23+
],
24+
[
25+
[0,0,0],
26+
[0,0,0]
27+
],
28+
[
29+
[0,0,100],
30+
[255,255,255]
31+
]
32+
])('Should return the color in RGB format.',(colorHsl,expected)=>{
33+
expect(hslToRgb(colorHsl)).toEqual(expected)
34+
})
35+
36+
test.each([
37+
[[360,180,9],'Input is not a valid HSL color.'],
38+
[[-90,46,8],'Input is not a valid HSL color.'],
39+
[[1,39,900],'Input is not a valid HSL color.'],
40+
[[1,139,100],'Input is not a valid HSL color.']
41+
])('Should return the error message.',(colorHsl,expected)=>{
42+
expect(()=>hslToRgb(colorHsl)).toThrowError(expected)
43+
})
44+
})

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp