UNPKG

@hello.nrfcloud.com/proto

Version:

Documents the communication protocol between the hello.nrfcloud.com backend and the web application

19 lines (18 loc) 1 kB
import assert from 'node:assert/strict'; import { describe, test as it } from 'node:test'; import { validateWithTypeBox } from 'validator/validateWithTypeBox.js'; import { IsoDateType } from './IsoDateType.js'; void describe('isoDateRegExp', function() { void it('should match a date string', function() { var isoTs = new Date().toISOString(); var maybeValid = validateWithTypeBox(IsoDateType())(isoTs); assert.equal('errors' in maybeValid, false); assert.equal('value' in maybeValid && (maybeValid === null || maybeValid === void 0 ? void 0 : maybeValid.value), isoTs); }); void it('should validate a date string with local timezone', function() { var isoTs = '2024-07-01T16:33:15+02:00'; var maybeValid = validateWithTypeBox(IsoDateType())(isoTs); assert.equal('errors' in maybeValid, false); assert.equal('value' in maybeValid && (maybeValid === null || maybeValid === void 0 ? void 0 : maybeValid.value), isoTs); }); });