UNPKG

typed-utilities

Version:
24 lines (22 loc) 1.02 kB
"use strict"; var _ = require(".."); describe(`RegExp`, () => { test(`dateIsoStringRegExp`, () => { const now = new Date(); const isoString = now.toISOString(); expect(isoString).toMatch(_.dateIsoStringRegExp); expect(` ${isoString}`).not.toMatch(_.dateIsoStringRegExp); expect(now.toString()).not.toMatch(_.dateIsoStringRegExp); }); test(`naiveEmailRegExp`, () => { expect(`user@domain.tld`).toMatch(_.naiveEmailRegExp); expect(`user-domain-tld`).not.toMatch(_.naiveEmailRegExp); const veryLongSubDomain = (0, _.range)(100).map(() => `subdomain`).join(`.`); const veryLongDomain = `domain`.repeat(100); const veryLongTld = `tld`.repeat(100); const veryLongUser = (0, _.range)(100).map(() => `user`).join(`.`); const veryLongModifier = (0, _.range)(100).map(() => `modifier`).join(`+`); expect(`${veryLongUser}+${veryLongModifier}@${veryLongSubDomain}.${veryLongDomain}.${veryLongTld}`).toMatch(_.naiveEmailRegExp); }); }); //# sourceMappingURL=RegExp.test.js.map