| 1269 | } |
| 1270 | |
| 1271 | function getEventData(eventType, value) { |
| 1272 | const bodyArray = []; |
| 1273 | //EVENT TYPE |
| 1274 | bodyArray.push(utils.allocBufferFromArray([0, eventType.length])); |
| 1275 | bodyArray.push(utils.allocBufferFromString(eventType)); |
| 1276 | //STATUS CHANGE DESCRIPTION |
| 1277 | bodyArray.push(utils.allocBufferFromArray([0, value.length])); |
| 1278 | bodyArray.push(utils.allocBufferFromString(value)); |
| 1279 | //Address |
| 1280 | bodyArray.push(utils.allocBufferFromArray([4, 127, 0, 0, 1])); |
| 1281 | //Port |
| 1282 | bodyArray.push(utils.allocBufferFromArray([0, 0, 0, 200])); |
| 1283 | |
| 1284 | const body = Buffer.concat(bodyArray); |
| 1285 | const header = new types.FrameHeader(2, 0, -1, types.opcodes.event, body.length); |
| 1286 | return {header: header, chunk: body}; |
| 1287 | } |
| 1288 | |
| 1289 | function buildParserAndExpect(validationFn) { |
| 1290 | const parser = newInstance(); |