aewx-metar-parser 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/convert.test.js +38 -42
- package/dist/metar-parser.test.js +292 -308
- package/package.json +5 -3
- package/src/convert.test.ts +44 -50
- package/src/metar-parser.test.ts +324 -345
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aewx-metar-parser",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Parse METAR information into structured JavaScript object",
|
|
5
5
|
"directories": {
|
|
6
6
|
"test": "test",
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
},
|
|
9
9
|
"main": "dist/metar-parser.js",
|
|
10
10
|
"scripts": {
|
|
11
|
-
"test": "node
|
|
11
|
+
"test": "node --test 'dist/**/*.test.js'",
|
|
12
|
+
"test:coverage": "node --test --experimental-test-coverage 'dist/**/*.test.js'",
|
|
13
|
+
"test:watch": "node --test --watch 'dist/**/*.test.js'",
|
|
12
14
|
"prettier": "npx prettier --cache --write .",
|
|
13
15
|
"eslint": "npx eslint **/*.ts --fix",
|
|
14
16
|
"tsc": "npx tsc --build",
|
|
@@ -40,5 +42,5 @@
|
|
|
40
42
|
"url": "https://github.com/fboes/metar-parser/issues"
|
|
41
43
|
},
|
|
42
44
|
"homepage": "https://github.com/fboes/metar-parser#readme",
|
|
43
|
-
"types": "./types/
|
|
45
|
+
"types": "./types/metar-parser.d.ts"
|
|
44
46
|
}
|
package/src/convert.test.ts
CHANGED
|
@@ -1,53 +1,47 @@
|
|
|
1
1
|
import { strict as assert } from "node:assert";
|
|
2
|
+
import { describe, it } from "node:test";
|
|
2
3
|
import { convert } from "./convert.js";
|
|
3
4
|
|
|
4
|
-
{
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
{
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const mps = convert.ktsToMps(1);
|
|
48
|
-
// console.log(mps);
|
|
49
|
-
assert.ok(mps > 0.51);
|
|
50
|
-
assert.ok(mps < 0.52);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
console.log("✅ All conversion tests successful");
|
|
5
|
+
describe("Conversion Tests", () => {
|
|
6
|
+
it("should convert temperature units correctly", () => {
|
|
7
|
+
const fahrenheit = convert.celsiusToFahrenheit(1);
|
|
8
|
+
assert.ok(fahrenheit > 33.75);
|
|
9
|
+
assert.ok(fahrenheit < 33.85);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("should convert pressure units correctly", () => {
|
|
13
|
+
const hgin = convert.kpaToInhg(1);
|
|
14
|
+
assert.ok(hgin > 0.29);
|
|
15
|
+
assert.ok(hgin < 0.3);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("should convert pressure units correctly", () => {
|
|
19
|
+
const kpa = convert.inhgToKpa(1);
|
|
20
|
+
assert.ok(kpa > 3.38);
|
|
21
|
+
assert.ok(kpa < 3.39);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("should convert distance units correctly", () => {
|
|
25
|
+
const meters = convert.milesToMeters(1);
|
|
26
|
+
assert.ok(meters > 1609);
|
|
27
|
+
assert.ok(meters < 1610);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("should convert speed units correctly", () => {
|
|
31
|
+
const mps = convert.kphToMps(1);
|
|
32
|
+
assert.ok(mps > 0.277);
|
|
33
|
+
assert.ok(mps < 0.278);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("should convert nautical speed units correctly", () => {
|
|
37
|
+
const kts = convert.mpsToKts(1);
|
|
38
|
+
assert.ok(kts > 1.94);
|
|
39
|
+
assert.ok(kts < 1.95);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("should convert back nautical speed units correctly", () => {
|
|
43
|
+
const mps = convert.ktsToMps(1);
|
|
44
|
+
assert.ok(mps > 0.51);
|
|
45
|
+
assert.ok(mps < 0.52);
|
|
46
|
+
});
|
|
47
|
+
});
|