UNPKG

@hello.nrfcloud.com/proto

Version:

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

25 lines (24 loc) 962 B
import assert from 'node:assert/strict'; import { describe, it } from 'node:test'; import { validateWithTypeBox } from 'validator/validateWithTypeBox.js'; import { LwM2MObjectUpdate } from './LwM2MObjectUpdate.js'; void describe('LwM2MObjectUpdate', function() { void it('should validate', function() { var input = { '@context': 'https://github.com/hello-nrfcloud/proto/lwm2m/object/update', ObjectID: 14201, ObjectVersion: '1.0', ObjectInstanceID: 0, Resources: { '0': 70.374978, '1': 31.104015, '3': 1, '6': 'Fixed', '99': new Date('2024-04-19T08:30:00.000Z').getTime() } }; var maybeValid = validateWithTypeBox(LwM2MObjectUpdate)(input); assert.equal('errors' in maybeValid, false); assert.deepEqual('value' in maybeValid && maybeValid.value, input); }); });