UNPKG

@hello.nrfcloud.com/proto-map

Version:

Documents the communication protocol between devices, the hello.nrfcloud.com/map backend and web application

44 lines (43 loc) 1.64 kB
import assert from 'node:assert/strict'; import { describe, it } from 'node:test'; import { validate } from '../validate.js'; import { Email } from './Email.js'; import invalidEmails from './test/invalid-emails.json' assert { type: 'json' }; var v = validate(Email); void describe('it should validate emails', function() { var _loop = function(_i, _iter) { var validEmail = _iter[_i]; void it("should validate ".concat(validEmail), function() { assert.equal('errors' in v(validEmail), false, "".concat(validEmail, " should be valid")); }); }; for(var _i = 0, _iter = [ 'alex@example.com', 'a@a.no' ]; _i < _iter.length; _i++)_loop(_i, _iter); var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined; try { var _loop1 = function() { var email = _step.value; void it("should not validate ".concat(email), function() { assert.equal('errors' in v(email), true, "The email ".concat(email, " should not be valid!")); }); }; for(var _iterator = invalidEmails[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop1(); } catch (err) { _didIteratorError = true; _iteratorError = err; } finally{ try { if (!_iteratorNormalCompletion && _iterator.return != null) { _iterator.return(); } } finally{ if (_didIteratorError) { throw _iteratorError; } } } });