UNPKG

@rr0/cms

Version:

RR0 Content Management System (CMS)

28 lines (27 loc) 1.28 kB
import { beforeEach, describe, expect, test } from "@javarome/testscript"; import { GooglePlaceService, PlaceLocation } from "@rr0/place"; describe("PlaceService", () => { const apiKey = process.env.GOOGLE_MAPS_API_KEY; if (!apiKey) { throw Error("GOOGLE_MAPS_API_KEY is required"); } let service; beforeEach(() => { service = new GooglePlaceService("place", apiKey); }); const lanlPosition = new PlaceLocation(35.8440582, -106.287162); const lanlElevation = 2161.025390625; test("build place with one first name", { skip: true }, async () => { var _a; const laln = await service.get("LANL"); expect(laln === null || laln === void 0 ? void 0 : laln.locations).toEqual([lanlPosition]); expect((_a = laln === null || laln === void 0 ? void 0 : laln.elevation) === null || _a === void 0 ? void 0 : _a.elevation).toBe(lanlElevation); }); test("read", { skip: true }, async () => { var _a; const fileName = service.getFileName(lanlPosition); const result = await service.read(fileName); expect(result.locations).toEqual([lanlPosition]); expect((_a = result.elevation) === null || _a === void 0 ? void 0 : _a.elevation).toBe(lanlElevation); }); });