import { hexToHSL, gteAndLt, HSLToHex } from './helpers'; import { darken10, lighten10 } from './index'; describe('tests helper functions in the color module', () => { test('tests HSLToHex function', () => { expect(hexToHSL('#ff0000')).toMatchObject({ h: 0, s: 100, l: 50 }); expect(hexToHSL('#ffff00')).toMatchObject({ h: 60, s: 100, l: 50 }); expect(hexToHSL('#00ff00')).toMatchObject({ h: 120, s: 100, l: 50 }); expect(hexToHSL('#00ffff')).toMatchObject({ h: 180, s: 100, l: 50 }); expect(hexToHSL('#0000ff')).toMatchObject({ h: 240, s: 100, l: 50 }); expect(hexToHSL('#ff00ff')).toMatchObject({ h: 300, s: 100, l: 50 }); expect(hexToHSL('#ff00ff0')).toMatchObject({ h: 0, s: 0, l: 0 }); }); test('tests darken10 and lighten10', () => { expect(darken10('#000000')).toBe('#000000'); expect(lighten10('#ffffff')).toBe('#ffffff'); }); test('tests HSLToHex function', () => { expect(HSLToHex(0, 100, 50)).toBe('#ff0000'); expect(HSLToHex(60, 100, 50)).toBe('#ffff00'); expect(HSLToHex(120, 100, 50)).toBe('#00ff00'); expect(HSLToHex(180, 100, 50)).toBe('#00ffff'); expect(HSLToHex(240, 100, 50)).toBe('#0000ff'); expect(HSLToHex(300, 100, 50)).toBe('#ff00ff'); expect(HSLToHex(360, 100, 50)).toBe('#ff0000'); }); test('tests gteAndLt function', () => { expect(gteAndLt(0, 100, 50)).toBe(false); }); });