From 6887a9d2a80ca2c5560095a9b67874dbb8c2c519 Mon Sep 17 00:00:00 2001 From: Teppo Kurki Date: Sat, 10 Feb 2024 05:57:31 +0200 Subject: [PATCH] add meteo test --- test/VDM.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/VDM.js b/test/VDM.js index effe144b..2e5b7c3e 100644 --- a/test/VDM.js +++ b/test/VDM.js @@ -237,4 +237,23 @@ describe('VDM', function () { .filter((pathValue) => pathValue.path === '')[3] .value.registrations.imo.should.equal('IMO 1010258') }) + + it('meteo converts ok', () => { + const delta = new Parser().parse( + '!AIVDM,1,1,,A,8@2R5Ph0GhOCT1a2VvkrgwvlFR06EuOwgqrqwnSwe7wvlOwwsAwwnSGmwvwt,0*40' + ) + delta.context.should.equal('meteo.urn:mrn:imo:mmsi:002655619.366097') + const output = [ + ['environment.water.level', -0.17], + ['environment.water.levelTendency', 'steady'], + ['environment.water.levelTendencyValue', 0], + ['environment.date', '2024-02-22T15:42:00.000Z'] + ] + output.forEach(([path, value]) => + delta.updates[0].values + .find((pathValue) => pathValue.path === path) + .value.should.equal(value) + ) + }) + })