UNPKG

@hello.nrfcloud.com/proto

Version:

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

20 lines (18 loc) 810 B
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', () => { void it('should match a date string', () => { const isoTs = new Date().toISOString() const maybeValid = validateWithTypeBox(IsoDateType())(isoTs) assert.equal('errors' in maybeValid, false) assert.equal('value' in maybeValid && maybeValid?.value, isoTs) }) void it('should validate a date string with local timezone', () => { const isoTs = '2024-07-01T16:33:15+02:00' const maybeValid = validateWithTypeBox(IsoDateType())(isoTs) assert.equal('errors' in maybeValid, false) assert.equal('value' in maybeValid && maybeValid?.value, isoTs) }) })