UNPKG

@hello.nrfcloud.com/proto-map

Version:

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

20 lines (18 loc) 759 B
import assert from 'node:assert/strict' import { describe, test as it } from 'node:test' import { validate } from '../validate.js' import { IsoDateType } from './IsoDateType.js' void describe('isoDateRegExp', () => { void it('should match a date string', () => { const isoTs = new Date().toISOString() const maybeValid = validate(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 = validate(IsoDateType())(isoTs) assert.equal('errors' in maybeValid, false) assert.equal('value' in maybeValid && maybeValid?.value, isoTs) }) })