fast-check
Version:
Property based testing framework for JavaScript (like QuickCheck)
12 lines (11 loc) • 630 B
JavaScript
import { array } from './ArrayArbitrary.js';
import { buildLowerAlphaNumericArb } from './helpers/SpecificCharacterRange.js';
import { domain } from './HostArbitrary.js';
import { stringOf } from './StringArbitrary.js';
import { tuple } from './TupleArbitrary.js';
export function emailAddress() {
const others = ['!', '#', '$', '%', '&', "'", '*', '+', '-', '/', '=', '?', '^', '_', '`', '{', '|', '}', '~'];
const atextArb = buildLowerAlphaNumericArb(others);
const dotAtomArb = array(stringOf(atextArb, 1, 10), 1, 5).map((a) => a.join('.'));
return tuple(dotAtomArb, domain()).map(([lp, d]) => `${lp}@${d}`);
}