From 929aa0680a1df73b7cad260ff168ed74bcb22e6e Mon Sep 17 00:00:00 2001 From: Alexander Harding <2166114+aeharding@users.noreply.github.com> Date: Thu, 16 May 2024 00:06:58 -0500 Subject: [PATCH] Add support for runway "none" coverage (#97) Resolves #96 --- src/model/enum.ts | 8 ++++++++ tests/parser/parser.test.ts | 19 ++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/model/enum.ts b/src/model/enum.ts index 78abadb..b447905 100644 --- a/src/model/enum.ts +++ b/src/model/enum.ts @@ -403,6 +403,14 @@ export enum DepositType { } export enum DepositCoverage { + /** + * Only reported by certain countries (e.g. Russia) + */ + None = "0", + + /** + * Not reported (e.g. due to rwy clearance in progress) + */ NotReported = "/", Less10 = "1", diff --git a/tests/parser/parser.test.ts b/tests/parser/parser.test.ts index 93ba166..348b7ba 100644 --- a/tests/parser/parser.test.ts +++ b/tests/parser/parser.test.ts @@ -22,8 +22,13 @@ import { IcingIntensity, MetarType, AltimeterUnit, + DepositCoverage, } from "model/enum"; -import { IAbstractWeatherContainer, IRunwayInfoRange } from "model/model"; +import { + IAbstractWeatherContainer, + IRunwayInfoDeposit, + IRunwayInfoRange, +} from "model/model"; import { Direction } from "model/enum"; import en from "locale/en"; import { _, format } from "commons/i18n"; @@ -548,6 +553,18 @@ describe("MetarParser", () => { expect(metar.remarks).toHaveLength(1); }); + test("with 'none' runway deposit", () => { + const input = "UUWW 151030Z 34002MPS CAVOK 14/02 Q1026 R01/000070 NOSIG"; + + const metar = new MetarParser(en).parse(input); + + expect(metar.runwaysInfo).toHaveLength(1); + expect(metar.runwaysInfo[0].name).toBe("01"); + expect((metar.runwaysInfo[0] as IRunwayInfoDeposit).coverage).toBe( + DepositCoverage.None, + ); + }); + test("with nil", () => { const metar = new MetarParser(en).parse("SVMC 211703Z AUTO NIL");