Skip to content

Commit

Permalink
fix: output callsignVhf with empty path
Browse files Browse the repository at this point in the history
  • Loading branch information
tkurki committed Dec 9, 2024
1 parent 3b0401a commit d91e52a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
9 changes: 7 additions & 2 deletions pgns/129794.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,13 @@ module.exports = [
}
},
{
node: 'communication.callsignVhf',
source: 'Callsign'
node: '',
filter: n2k => n2k.fields['Callsign'],
value: n2k => ({
communication: {
callsignVhf: n2k.fields['Callsign']
}
})
},
{
node: 'design.beam',
Expand Down
9 changes: 7 additions & 2 deletions pgns/129810.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@ module.exports = [
source: 'Beam'
},
{
node: 'communication.callsignVhf',
source: 'Callsign'
node: '',
filter: n2k => n2k.fields['Callsign'],
value: n2k => ({
communication: {
callsignVhf: n2k.fields['Callsign']
}
})
},
{
node: 'sensors.ais.fromBow',
Expand Down
11 changes: 9 additions & 2 deletions test/129794_ais_class_a_static_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,22 @@ describe('129794 AIS Class A Static and Voyage Related Data', function () {
const valuesWithEmptyPath = delta.updates[0].values.filter(
pathValue => pathValue.path === ''
)
valuesWithEmptyPath.length.should.equal(3)
valuesWithEmptyPath.length.should.equal(4)
expect(valuesWithEmptyPath).to.have.deep.members([
{
path: '',
value: {
name: 'SILVER GWEN'
}
},
{
path: '',
value: {
communication: {
callsignVhf: '3FJJ4'
}
}
},
{
path: '',
value: {
Expand Down Expand Up @@ -91,7 +99,6 @@ describe('129794 AIS Class A Static and Voyage Related Data', function () {
)
tree.should.have.nested.property('sensors.ais.fromBow.value', 147.0)
tree.should.have.nested.property('sensors.ais.fromCenter.value', 8)
tree.should.have.nested.property('communication.callsignVhf.value', '3FJJ4')
delete tree.design.aisShipType
//TODO enable when sensors.ais.class is in the schema
//tree.should.be.validSignalKVesselIgnoringIdentity
Expand Down

0 comments on commit d91e52a

Please sign in to comment.