js: avoid use of BigInt operations for older safari browsers [#103]

This commit is contained in:
Brandon Liu
2022-12-10 18:36:04 +08:00
parent 577bd9ede7
commit b8a78a7f6a
2 changed files with 28 additions and 11 deletions

View File

@@ -14,6 +14,7 @@ import {
RangeResponse,
EtagMismatch,
PMTiles,
getUint64,
} from "../index";
test("varint", () => {
@@ -171,6 +172,16 @@ test("cache getHeader", async () => {
assert.strictEqual(header.maxLat, 1);
});
test("getUint64", async () => {
const view = new DataView(new ArrayBuffer(8));
view.setBigUint64(0, 0n, true);
assert.strictEqual(getUint64(view, 0), 0);
view.setBigUint64(0, 1n, true);
assert.strictEqual(getUint64(view, 0), 1);
view.setBigUint64(0, 9007199254740991n, true);
assert.strictEqual(getUint64(view, 0), 9007199254740991);
});
test("cache check against empty", async () => {
const source = new TestNodeFileSource("test/data/empty.pmtiles", "1");
const cache = new SharedPromiseCache();