import getContrastText from '../getContrastText';

test('getContrastText returns white if the color is dark enough', () => {
    expect(getContrastText('rgb(255, 100, 0)')).toBe('#ffffff');
});

test('getContrastText returns black if the color is bright enough', () => {
    expect(getContrastText('rgb(255, 201, 0)')).toBe('#000000');
});

test('getContrastText returns the given lightColor and darkColor with custom threshold', () => {
    expect(
        getContrastText('rgb(255, 201, 0)', { darkColor: '#ff0000', lightColor: '#00ff00', threshold: 2 })
    ).toBe('#ff0000');
    expect(
        getContrastText('rgb(100, 100, 0)', { darkColor: '#ff0000', lightColor: '#00ff00', threshold: 2 })
    ).toBe('#00ff00');
});
