diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 70c6bb1..68cd8dd 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -7,12 +7,15 @@ on: paths-ignore: - "*.md" workflow_dispatch: - pull_request_review: - types: [submitted] + pull_request: + branches: + - main + paths-ignore: + - ".gitignore" + - "**.md" jobs: tests: - if: github.event.review.state == 'approved' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest strategy: matrix: @@ -23,10 +26,10 @@ jobs: - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node_version }} - - name: Check formatting + - name: Check formatting run: | - npm ci - npm run format-check + npm ci + npm run format-check - name: Docker run containers and tests env: GRAPHHOPPER_API_KEY: ${{ secrets.GRAPHHOPPER_API_KEY }} diff --git a/packages/ors/ors.test.ts b/packages/ors/ors.test.ts deleted file mode 100644 index a7cfa09..0000000 --- a/packages/ors/ors.test.ts +++ /dev/null @@ -1,119 +0,0 @@ -import { ORS } from "./index" -import { assertError } from "../../util/error" - -const ors = new ORS({ - baseUrl: "http://localhost:8080/ors", -}) - -describe("ORS returns responses", () => { - it("gets a direction response", async () => { - await ors - .directions( - [ - [42.5063, 1.51886], - [42.51007, 1.53789], - ], - "driving-car" - ) - .then((d) => { - expect(d.directions).toHaveLength(1) - expect(d.directions[0].feature.geometry).toHaveProperty( - "coordinates" - ) - }) - }) - - it("gets a direction response from geojson endpoint", async () => { - await ors - .directions( - [ - [42.5063, 1.51886], - [42.51007, 1.53789], - ], - "driving-car", - {}, - false, - "geojson" - ) - .then((d) => { - expect(d.directions).toHaveLength(1) - expect(d.directions[0].feature.geometry).toHaveProperty( - "coordinates" - ) - }) - }) - - it("gets an isochrone response", async () => { - await ors - .reachability([42.5063, 1.51886], "driving-car", [150, 300]) - .then((i) => { - expect(i.isochrones).toHaveLength(2) - }) - }) - - it("gets a matrix response", async () => { - await ors - .matrix( - [ - [42.5063, 1.51886], - [42.51007, 1.53789], - ], - "driving-car", - { metrics: ["distance", "duration"] } - ) - .then((m) => { - expect(m.distances).toBeDefined() - expect(m.distances).toHaveLength(2) - expect(m.durations).toBeDefined() - expect(m.durations).toHaveLength(2) - }) - }) -}) - -describe("Throws RoutingJSAPIError", () => { - it("fails to get a direction response", async () => { - await ors - .directions( - [ - [0.00001, 1], - [42.51007, 1.53789], - ], - "driving-car" - ) - .catch(assertError) - }) - - it("fails to get a direction response from geojson endpoint", async () => { - await ors - .directions( - [ - [0.00001, 1], - [42.51007, 1.53789], - ], - "driving-car", - {}, - false, - "geojson" - ) - .catch(assertError) - }) - - it("fails to get an isochrone response", async () => { - await ors - .reachability([0.00001, 1], "driving-car", [150, 300]) - .catch(assertError) - }) - - it("fails to get a matrix response", async () => { - await ors - .matrix( - [ - [0.00001, 1], - [42.51007, 1.53789], - ], - "driving-car", - { metrics: ["distance", "duration"] } - ) - .catch(assertError) - }) -})