UNPKG

isochrone-explorer

Version:

A powerful isochrone and routing engine based on Dijkstra's algorithm for accurate travel time calculations.

21 lines (16 loc) 761 B
const OpenRouteService = require("../lib/isochrone"); describe("OpenRouteService", () => { const apiKey = "test-api-key"; const ors = new OpenRouteService(apiKey); test("should throw error if API key is missing", () => { expect(() => new OpenRouteService()).toThrow("API key is required."); }); test("should throw error if profile is missing", async () => { await expect(ors.getIsochrone({})).rejects.toThrow("Profile is required"); }); test("should throw error if coordinates are invalid", async () => { await expect( ors.getIsochrone({ profile: "driving-car", range: 600 }) ).rejects.toThrow("Coordinates must be an array of [longitude, latitude]."); }); });