validatable
Version:
A library for synchronous and asynchronous input validation.
15 lines (11 loc) • 323 B
JavaScript
import test from 'ava';
import { stringHexColor } from '../../dist/validators';
test('fails when not a string', (t) => {
t.is(stringHexColor(true), false);
});
test('fails when invalid', (t) => {
t.is(stringHexColor('#ff'), false);
});
test('passes when valid', (t) => {
t.is(stringHexColor('#ff0034'), true);
});