Migrated tests to jest

Used jest-codemods to migrate, will have to pass everything by hand before we can merge.
This commit is contained in:
Angelos Chalaris
2018-06-18 14:18:25 +03:00
parent ae8cd7ee50
commit 5afe81452a
890 changed files with 6950 additions and 6921 deletions

View File

@ -1,20 +0,0 @@
const hexToRGB = hex => {
let alpha = false,
h = hex.slice(hex.startsWith('#') ? 1 : 0);
if (h.length === 3) h = [...h].map(x => x + x).join('');
else if (h.length === 8) alpha = true;
h = parseInt(h, 16);
return (
'rgb' +
(alpha ? 'a' : '') +
'(' +
(h >>> (alpha ? 24 : 16)) +
', ' +
((h & (alpha ? 0x00ff0000 : 0x00ff00)) >>> (alpha ? 16 : 8)) +
', ' +
((h & (alpha ? 0x0000ff00 : 0x0000ff)) >>> (alpha ? 8 : 0)) +
(alpha ? `, ${h & 0x000000ff}` : '') +
')'
);
};
module.exports = hexToRGB;

View File

@ -1,16 +0,0 @@
const test = require('tape');
const hexToRGB = require('./hexToRGB.js');
test('Testing hexToRGB', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof hexToRGB === 'function', 'hexToRGB is a Function');
t.equal(hexToRGB('#27ae60ff'), 'rgba(39, 174, 96, 255)', "Converts a color code to a rgb() or rgba() string");
t.equal(hexToRGB('27ae60'), 'rgb(39, 174, 96)', "Converts a color code to a rgb() or rgba() string");
t.equal(hexToRGB('#fff'), 'rgb(255, 255, 255)', "Converts a color code to a rgb() or rgba() string");
//t.deepEqual(hexToRGB(args..), 'Expected');
//t.equal(hexToRGB(args..), 'Expected');
//t.false(hexToRGB(args..), 'Expected');
//t.throws(hexToRGB(args..), 'Expected');
t.end();
});