js client: show error when future spec version is read

This commit is contained in:
Brandon Liu
2022-11-01 17:02:49 +08:00
parent 92f6670640
commit 302eeab47e
3 changed files with 19 additions and 2 deletions

View File

@@ -192,7 +192,17 @@ test("cache check magic number", async (assertion) => {
await cache.getHeader(source);
assertion.fail("Should have thrown");
} catch (e) {
console.log(e);
assertion.ok(e instanceof Error);
}
});
test("cache check future spec version", async (assertion) => {
const source = new TestNodeFileSource("test/data/invalid_v4.pmtiles", "1");
const cache = new SharedPromiseCache();
try {
await cache.getHeader(source);
assertion.fail("Should have thrown");
} catch (e) {
assertion.ok(e instanceof Error);
}
});