Skip to content

Commit

Permalink
Add support for runway "none" coverage (#97)
Browse files Browse the repository at this point in the history
Resolves #96
  • Loading branch information
aeharding authored May 16, 2024
1 parent 664a53d commit 929aa06
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/model/enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
19 changes: 18 additions & 1 deletion tests/parser/parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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");

Expand Down

0 comments on commit 929aa06

Please sign in to comment.