"use strict"; // AlexaStatusMessage and AlexaErrorResponse, the message classes of 1.x: the JSON of 1.5.2, and the four places // where 2.0 differs from it on the wire (DESIGN.md, 6.1). const { test } = require("node:test"); const assert = require("node:assert/strict"); const { Alex2MQTT, AlexaErrorResponse, AlexaErrorType, AlexaInterfaceType, AlexaStatusMessage, DisplayCategory, EndpointHealth, PowerController, TemperatureSensorScale, } = require("alex2node"); const { setup, sleep, UUID_V4 } = require("../helpers/harness.js"); const ISO_TIME = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/; // The message with its id and its times checked and replaced by their names, so that the rest compares as a whole function settled(message) { const json = JSON.parse(JSON.stringify(message)); assert.match(json.event.header.messageId, UUID_V4); json.event.header.messageId = ""; const lists = [json.context?.properties, json.event.payload.change?.properties].filter(Boolean); for (const property of lists.flat()) { assert.match(property.timeOfSample, ISO_TIME); property.timeOfSample = "