collabSupport/tests/ciscoMppPhone.nsJson.test.js
jmcqueen f7953b8eb5 Add MPP desk phone diagnostics follow-up to /phonestatus via relay.
Wire CP-78xx probe discovery, relay phone-probe commands, and a chat follow-up message so store desk phones get registration, switch, and provisioning detail alongside DECT and WAN diagnostics.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-28 18:01:01 -04:00

23 lines
857 B
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { parseNsJson } from '../integrations/cisco-mpp-phone/nsJson.js';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const FIXTURE = fs.readFileSync(path.join(__dirname, 'fixtures/mpp/ns-782.json'), 'utf8');
test('parseNsJson: extracts LLDP neighbor and port speed', () => {
const parsed = parseNsJson(FIXTURE);
assert.equal(parsed.switchDevice, 'SW00782R');
assert.equal(parsed.switchPort, 'Port 45');
assert.equal(parsed.switchIp, '10.229.105.251');
assert.match(parsed.portSpeed, /100/);
});
test('parseNsJson: omits zero error counters', () => {
const parsed = parseNsJson(FIXTURE);
assert.equal(Object.keys(parsed.errorCounters).length, 0);
});