UNPKG

validatable

Version:

A library for synchronous and asynchronous input validation.

19 lines (14 loc) 355 B
import test from 'ava'; import { presence } from '../../dist/validators'; test('fails when null', (t) => { t.is(presence(null), false); }); test('fails when undefined', (t) => { t.is(presence(), false); }); test('fails when blank', (t) => { t.is(presence(''), false); }); test('passes when present', (t) => { t.is(presence('john'), true); });