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); });