Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for runway "none" coverage #97

Merged
merged 2 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading