Test cleanup and fixes [q-r]

This commit is contained in:
Angelos Chalaris
2018-06-18 18:13:18 +03:00
parent 43e92c610d
commit ba3e684a27
23 changed files with 147 additions and 202 deletions

View File

@ -1,16 +1,15 @@
const expect = require('expect');
const randomHexColorCode = require('./randomHexColorCode.js');
test('randomHexColorCode is a Function', () => {
test('randomHexColorCode is a Function', () => {
expect(randomHexColorCode).toBeInstanceOf(Function);
});
t.equal(randomHexColorCode().length, 7);
test('The color code starts with "#"', () => {
test('randomHexColorCode has to proper length', () => {
expect(randomHexColorCode().length).toBe(7);
})
test('The color code starts with "#"', () => {
expect(randomHexColorCode().startsWith('#')).toBeTruthy();
});
test('The color code contains only valid hex-digits', () => {
test('The color code contains only valid hex-digits', () => {
expect(randomHexColorCode().slice(1).match(/[^0123456789abcdef]/i) === null).toBeTruthy();
});