diff --git a/pgns/129794.js b/pgns/129794.js index 5e6678c..bc8b4d8 100644 --- a/pgns/129794.js +++ b/pgns/129794.js @@ -20,7 +20,7 @@ module.exports = [ }, { node: 'navigation.destination.commonName', - source: 'Destination' + value: n2k => n2k.fields['Destination'] }, { node: 'design.draft', diff --git a/test/129794_ais_class_a_static_data.js b/test/129794_ais_class_a_static_data.js index 244303d..0981535 100644 --- a/test/129794_ais_class_a_static_data.js +++ b/test/129794_ais_class_a_static_data.js @@ -89,4 +89,42 @@ describe('129794 AIS Class A Static and Voyage Related Data', function () { //TODO enable when sensors.ais.class is in the schema //tree.should.be.validSignalKVesselIgnoringIdentity }) + + it('Empty destination converts to empty string', () => { + const msg = { + "prio": 6, + "pgn": 129794, + "dst": 255, + "src": 43, + "timestamp": "2014-08-15T19:05:41.030Z", + "input": [ + "2014-08-15T19:05:41.030Z,6,129794,43,255,75,05,b0,7f,79,10,00,00,00,00,45,53,59,32,31,31,31,50,56,4c,2d,31,31,31,20,56,41,50,50,45,52,20,20,20,20,20,20,37,7c,01,3c,00,14,00,b4,00,14,40,00,00,00,00,00,00,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,00,e1" + ], + "fields": { + "Message ID": 5, + "Repeat indicator": "Initial", + "User ID": 276398000, + "IMO number": 0, + "Callsign": "ESY2111", + "Name": "PVL-111 VAPPER", + "Type of ship": "Law enforcement", + "Length": 38, + "Beam": 6, + "Position reference from Starboard": 2, + "Position reference from Bow": 18, + "ETA Date": "2014.11.30", + "ETA Time": "00:00:00", + "Draft": 0, + "Destination": "", + "AIS version indicator": "ITU-R M.1371-1", + "GNSS type": "undefined", + "DTE": "available", + "Reserved1": "0", + "AIS Transceiver information": "Channel B VDL reception" + }, + "description": "AIS Class A Static and Voyage Related Data" + } + const delta = mapper.toDelta(msg) + delta.updates[0].values.find((pv) => pv.path === 'navigation.destination.commonName').value.should.equal('') + }) })