Test migration to jest by hand
Apparently using regular expressions is way easier.
This commit is contained in:
8
test/extendHex/extendHex.js
Normal file
8
test/extendHex/extendHex.js
Normal file
@ -0,0 +1,8 @@
|
||||
const extendHex = shortHex =>
|
||||
'#' +
|
||||
shortHex
|
||||
.slice(shortHex.startsWith('#') ? 1 : 0)
|
||||
.split('')
|
||||
.map(x => x + x)
|
||||
.join('');
|
||||
module.exports = extendHex;
|
||||
10
test/extendHex/extendHex.test.js
Normal file
10
test/extendHex/extendHex.test.js
Normal file
@ -0,0 +1,10 @@
|
||||
const expect = require('expect');
|
||||
const extendHex = require('./extendHex.js');
|
||||
|
||||
|
||||
test('extendHex is a Function', () => {
|
||||
expect(extendHex).toBeInstanceOf(Function);
|
||||
});
|
||||
t.equal(extendHex('#03f'), '#0033ff', "Extends a 3-digit color code to a 6-digit color code");
|
||||
t.equal(extendHex('05a'), '#0055aa', "Extends a 3-digit color code to a 6-digit color code");
|
||||
|
||||
Reference in New Issue
Block a user