UNPKG

fast-check

Version:

Property based testing framework for JavaScript (like QuickCheck)

16 lines (15 loc) 890 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.emailAddress = void 0; const ArrayArbitrary_1 = require("./ArrayArbitrary"); const SpecificCharacterRange_1 = require("./helpers/SpecificCharacterRange"); const HostArbitrary_1 = require("./HostArbitrary"); const StringArbitrary_1 = require("./StringArbitrary"); const TupleArbitrary_1 = require("./TupleArbitrary"); function emailAddress() { const others = ['!', '#', '$', '%', '&', "'", '*', '+', '-', '/', '=', '?', '^', '_', '`', '{', '|', '}', '~']; const atextArb = SpecificCharacterRange_1.buildLowerAlphaNumericArb(others); const dotAtomArb = ArrayArbitrary_1.array(StringArbitrary_1.stringOf(atextArb, 1, 10), 1, 5).map((a) => a.join('.')); return TupleArbitrary_1.tuple(dotAtomArb, HostArbitrary_1.domain()).map(([lp, d]) => `${lp}@${d}`); } exports.emailAddress = emailAddress;