From 9bf23991c8aadcd0e01838e839dbb119dece52d4 Mon Sep 17 00:00:00 2001 From: Alexander Harding <2166114+aeharding@users.noreply.github.com> Date: Wed, 15 May 2024 12:08:54 -0500 Subject: [PATCH 1/2] Add support for runway "none" coverage 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..8a08119 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"; @@ -235,6 +240,18 @@ describe("MetarParser", () => { expect((metar.runwaysInfo[0] as IRunwayInfoRange).trend).toBe("N"); }); + test("supports runway 'none' coverage", () => { + 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("parses 'AUTO' as station if no station identifier", () => { const input = "AUTO 061950Z 10002KT 9999NDV NCD 01/M00 Q1015 RMK="; From 471f739744326e0d61920ffec2cc0a4550897714 Mon Sep 17 00:00:00 2001 From: Alexander Harding <2166114+aeharding@users.noreply.github.com> Date: Wed, 15 May 2024 12:10:59 -0500 Subject: [PATCH 2/2] Move test --- tests/parser/parser.test.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/parser/parser.test.ts b/tests/parser/parser.test.ts index 8a08119..348b7ba 100644 --- a/tests/parser/parser.test.ts +++ b/tests/parser/parser.test.ts @@ -240,18 +240,6 @@ describe("MetarParser", () => { expect((metar.runwaysInfo[0] as IRunwayInfoRange).trend).toBe("N"); }); - test("supports runway 'none' coverage", () => { - 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("parses 'AUTO' as station if no station identifier", () => { const input = "AUTO 061950Z 10002KT 9999NDV NCD 01/M00 Q1015 RMK="; @@ -565,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");