From 818c8b23204d22fa7399acb4591f62c2aaec4775 Mon Sep 17 00:00:00 2001 From: panaaj <38519157+panaaj@users.noreply.github.com> Date: Fri, 15 Nov 2024 09:58:58 +1030 Subject: [PATCH] Fix BWC no position handling. Send delta with nextPoint.position value = null --- hooks/BWC.js | 5 +++++ test/BWC.js | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/hooks/BWC.js b/hooks/BWC.js index b4ee813f..5d431f30 100644 --- a/hooks/BWC.js +++ b/hooks/BWC.js @@ -66,6 +66,11 @@ module.exports = function BWCHook(input) { latitude, }, }) + } else { + values.push({ + path: 'navigation.courseGreatCircle.nextPoint.position', + value: null, + }) } if (parts[9] !== '' && parts[10] !== '') { diff --git a/test/BWC.js b/test/BWC.js index e1f53494..0a86f0c7 100644 --- a/test/BWC.js +++ b/test/BWC.js @@ -63,6 +63,10 @@ describe('BWC', () => { delta.should.be.an('object') delta.updates[0].values.should.deep.equal([ + { + path: 'navigation.courseGreatCircle.nextPoint.position', + value: null, + }, { path: 'navigation.courseGreatCircle.nextPoint.distance', value: 40929.20003454424, @@ -80,6 +84,12 @@ describe('BWC', () => { it("Doesn't choke on an empty sentence", () => { const delta = new Parser().parse('$GPBWC,,,,,,,,,,,,*41') - should.equal(delta, undefined) + + delta.updates[0].values.should.deep.equal([ + { + path: 'navigation.courseGreatCircle.nextPoint.position', + value: null, + }, + ]) }) })