Skip to content

Commit 3259e18

Browse files
committed
Bump @neaps/tide-predictor
1 parent 4966483 commit 3259e18

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"format": "prettier --write ."
3737
},
3838
"devDependencies": {
39-
"@neaps/tide-predictor": "^0.4.0",
39+
"@neaps/tide-predictor": "^0.4.1",
4040
"@types/make-fetch-happen": "^10.0.4",
4141
"@types/node": "^25.0.3",
4242
"ajv": "^8.17.1",

test/validate.test.ts

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#!/usr/bin/env node
22

3-
import { describe, test } from "vitest";
3+
import { describe, test, expect } from "vitest";
44
import { readFile } from "fs/promises";
55
import { join } from "path";
66
import Ajv2020 from "ajv/dist/2020.js";
77
import addFormats from "ajv-formats";
88
import { stations } from "../src/index.js";
9+
import tidePredictor from "@neaps/tide-predictor";
910

1011
const ROOT = new URL("..", import.meta.url).pathname;
1112
const SCHEMA_PATH = join(ROOT, "schemas", "station.schema.json");
@@ -17,13 +18,26 @@ const validate = ajv.compile(schema);
1718

1819
describe("schema", () => {
1920
stations.forEach((station) => {
20-
test(`Station ${station.id}`, () => {
21-
const valid = validate(station);
22-
if (!valid)
23-
throw new Error(
24-
ajv.errorsText(validate.errors) +
25-
`\n${JSON.stringify(validate.errors, null, 2)}`,
26-
);
21+
describe(station.id, () => {
22+
test("is valid", () => {
23+
const valid = validate(station);
24+
if (!valid)
25+
throw new Error(
26+
ajv.errorsText(validate.errors) +
27+
`\n${JSON.stringify(validate.errors, null, 2)}`,
28+
);
29+
});
30+
31+
if (station.harmonic_constituents) {
32+
test("uses constituents supported by neaps", () => {
33+
station.harmonic_constituents.forEach((hc) => {
34+
expect(
35+
tidePredictor.constituents[hc.name],
36+
`Unsupported constituent: ${hc.name}`,
37+
).toBeDefined();
38+
});
39+
});
40+
}
2741
});
2842
});
2943
});

0 commit comments

Comments
 (0)