UNPKG

code-theme-converter

Version:

Convert any vscode theme with ease!

49 lines (48 loc) 1.68 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const color_1 = require("../color"); describe('util/color', () => { describe('hex2Rgb', () => { it('should be defined', () => { expect(color_1.hex2Rgb).toBeDefined(); }); it.each ` hex | result ${'#ffffff'} | ${[255, 255, 255]} ${'#fff'} | ${[255, 255, 255]} ${'#ff'} | ${[255]} ${'#ffff'} | ${[255, 255]} ${'#ffffffff'} | ${[255, 255, 255, 255]} ${''} | ${[0, 0, 0]} ${'234235'} | ${[52, 35]} `('should convert a hex string to an RGB array', ({ hex, result }) => { expect(color_1.hex2Rgb(hex)).toEqual(result); }); }); describe('hex2Rgba', () => { it('should be defined', () => { expect(color_1.hex2Rgba).toBeDefined(); }); it.each ` hex | result ${'#ffffff'} | ${[255, 255, 255, 0]} ${'#ffffffff'} | ${[255, 255, 255, 255]} ${''} | ${[0, 0, 0, 0]} `('should convert a hex string to an RGBA array', ({ hex, result }) => { expect(color_1.hex2Rgba(hex)).toEqual(result); }); }); describe('getAlphaFromHex', () => { it('should be defined', () => { expect(color_1.getAlphaFromHex).toBeDefined(); }); it.each ` hex | result ${'#ffffff'} | ${0} ${'#ffffffff'} | ${255} ${''} | ${0} `('should convert a hex string to an RGBA array', ({ hex, result }) => { expect(color_1.getAlphaFromHex(hex)).toEqual(result); }); }); });