|
| 1 | +import test from 'ava' |
| 2 | +import {hex2hsl} from '../src' |
| 3 | + |
| 4 | +test('test red color', t => { |
| 5 | + const hex = '#ff0000' |
| 6 | + const expected = 'hsl(0, 100%, 50%)' |
| 7 | + const actual = hex2hsl(hex) |
| 8 | + t.deepEqual(actual, expected) |
| 9 | +}) |
| 10 | + |
| 11 | +test('test green color', t => { |
| 12 | + const hex = '#00ff00' |
| 13 | + const expected = 'hsl(120, 100%, 50%)' |
| 14 | + const actual = hex2hsl(hex) |
| 15 | + t.deepEqual(actual, expected) |
| 16 | +}) |
| 17 | + |
| 18 | +test('test blue color', t => { |
| 19 | + const hex = '#0000ff' |
| 20 | + const expected = 'hsl(240, 100%, 50%)' |
| 21 | + const actual = hex2hsl(hex) |
| 22 | + t.deepEqual(actual, expected) |
| 23 | +}) |
| 24 | + |
| 25 | +test('test fabada color', t => { |
| 26 | + const hex = '#fabada' |
| 27 | + const expected = 'hsl(330, 86%, 85%)' |
| 28 | + const actual = hex2hsl(hex) |
| 29 | + t.deepEqual(actual, expected) |
| 30 | +}) |
| 31 | + |
| 32 | +test('test black color', t => { |
| 33 | + const hex = '#000000' |
| 34 | + const expected = 'hsl(0, 0%, 0%)' |
| 35 | + const actual = hex2hsl(hex) |
| 36 | + t.deepEqual(actual, expected) |
| 37 | +}) |
0 commit comments