"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const colors_1 = require("./colors");
describe('isHexCodeColor', () => {
    it('should return true for valid 3-digit hex colors', () => {
        const validColors = ['#123', '#abc', '#ABC', '#f00', '#0F0', '#00f'];
        validColors.forEach((color) => {
            expect((0, colors_1.isHexCodeColor)(color)).toBe(true);
        });
    });
    it('should return true for valid 6-digit hex colors', () => {
        const validColors = [
            '#123456',
            '#abcdef',
            '#ABCDEF',
            '#ff0000',
            '#00FF00',
            '#0000ff',
        ];
        validColors.forEach((color) => {
            expect((0, colors_1.isHexCodeColor)(color)).toBe(true);
        });
    });
    it('should return false for invalid hex colors', () => {
        const invalidColors = [
            'red', // named color
            '#1234', // 4 digits
            '#12345', // 5 digits
            '#1234567', // 7 digits
            '123456', // missing #
            '#12345g', // invalid character
            '#GHIJKL', // invalid characters
            'rgb(255,0,0)', // rgb format
            'rgba(255,0,0,0.5)', // rgba format
            '#', // just the hash
            '', // empty string
            ' #123456', // leading space
            '#123456 ', // trailing space
        ];
        invalidColors.forEach((color) => {
            expect((0, colors_1.isHexCodeColor)(color)).toBe(false);
        });
    });
});
describe('getInvalidHexColors', () => {
    it('should return an empty array when all colors are valid', () => {
        const validColors = ['#123', '#456789', '#abc', '#def012'];
        expect((0, colors_1.getInvalidHexColors)(validColors)).toEqual([]);
    });
    it('should return an array of invalid colors', () => {
        const mixedColors = ['#123', 'red', '#456789', '#12', 'blue'];
        const expectedInvalidColors = ['red', '#12', 'blue'];
        expect((0, colors_1.getInvalidHexColors)(mixedColors)).toEqual(expectedInvalidColors);
    });
    it('should return all colors when all are invalid', () => {
        const invalidColors = ['red', 'green', 'blue'];
        expect((0, colors_1.getInvalidHexColors)(invalidColors)).toEqual(invalidColors);
    });
    it('should handle an empty array', () => {
        expect((0, colors_1.getInvalidHexColors)([])).toEqual([]);
    });
});
describe('cleanColorArray', () => {
    it('should trim whitespace from color strings', () => {
        const colorsWithWhitespace = [' #123 ', '  #456789', '#abc  '];
        const expectedCleanedColors = ['#123', '#456789', '#abc'];
        expect((0, colors_1.cleanColorArray)(colorsWithWhitespace)).toEqual(expectedCleanedColors);
    });
    it('should filter out empty strings', () => {
        const colorsWithEmpty = ['#123', '', '  ', '#456789'];
        const expectedCleanedColors = ['#123', '#456789'];
        expect((0, colors_1.cleanColorArray)(colorsWithEmpty)).toEqual(expectedCleanedColors);
    });
    it('should handle an array with only empty strings', () => {
        const onlyEmptyStrings = ['', '  ', '   '];
        expect((0, colors_1.cleanColorArray)(onlyEmptyStrings)).toEqual([]);
    });
    it('should handle an empty array', () => {
        expect((0, colors_1.cleanColorArray)([])).toEqual([]);
    });
    it('should preserve invalid hex colors (validation is not its responsibility)', () => {
        const mixedColors = [' #123 ', 'red', '  #456789', 'blue  '];
        const expectedCleanedColors = ['#123', 'red', '#456789', 'blue'];
        expect((0, colors_1.cleanColorArray)(mixedColors)).toEqual(expectedCleanedColors);
    });
});
//# sourceMappingURL=colors.test.js.map