who_need_help/assets/js/map_interactions.test.mjs

14 lines
532 B
JavaScript

import assert from "node:assert/strict"
import {readFile} from "node:fs/promises"
import test from "node:test"
const hooksSource = await readFile(new URL("./hooks.js", import.meta.url), "utf8")
test("every embedded MapLibre map uses cooperative gestures", () => {
const constructors = hooksSource.match(/new maplibregl\.Map\(\{/g) || []
const cooperativeOptions = hooksSource.match(/cooperativeGestures:\s*true/g) || []
assert.equal(constructors.length, 2)
assert.equal(cooperativeOptions.length, constructors.length)
})