From 60ea1be7d1c4b0982bf7f96b918585aa90de0f6b Mon Sep 17 00:00:00 2001 From: Martin Schuhfuss Date: Tue, 12 Dec 2023 14:16:59 +0100 Subject: [PATCH] test: fix places/photo test --- e2e/places/photo.test.ts | 20 ++++++++++++++++---- jest.config.js | 1 - package.json | 6 +++--- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/e2e/places/photo.test.ts b/e2e/places/photo.test.ts index 7bbd13e9c8..000a458855 100644 --- a/e2e/places/photo.test.ts +++ b/e2e/places/photo.test.ts @@ -15,13 +15,25 @@ */ import { placePhoto } from "../../src/places/photo"; +import { placeDetails } from "../../src/places/details"; test("photo should return correct result", async () => { + const placeDetailsResponse = await placeDetails({ + params: { + // The Museum of Modern Art, 11 W 53rd St, New York + place_id: "ChIJKxDbe_lYwokRVf__s8CPn-o", + key: process.env.GOOGLE_MAPS_API_KEY, + fields: ["place_id", "photo"], + }, + }); + + const [photo] = placeDetailsResponse.data.result.photos; + const { photo_reference: photoreference } = photo; + const params = { - photoreference: - "AZose0kqzNAxzQSLYC-kxAidG_FkCelqG6lXa-05yhbKfwfGd0Agu4YXSjvArtNEYLC8CiCvQb4uxQzfn2fZi2kzxeMBgtOHmbo0c8eqMx_YPVNRCjjPL_kA77NOWF5wOS2ub6ZQlM0G8XibN93burBky0JLCE5sf-C6gLVEG74yiPYoK8id", - maxwidth: 100, - maxheight: 100, + photoreference, + maxwidth: 1000, + maxheight: 1000, key: process.env.GOOGLE_MAPS_API_KEY, }; const r = await placePhoto({ params: params, responseType: "arraybuffer" }); diff --git a/jest.config.js b/jest.config.js index 4df50da0ce..30839711c9 100644 --- a/jest.config.js +++ b/jest.config.js @@ -22,6 +22,5 @@ module.exports = { transformIgnorePatterns: [ "/node_modules/(?!(axios|retry-axios|query-string|decode-uri-component|split-on-first|filter-obj)/)", ], - collectCoverage: true, collectCoverageFrom: ["src/**/([a-zA-Z_]*).{js,ts}", "!**/*.test.{js,ts}"], }; diff --git a/package.json b/package.json index 3ca80b4cd8..582b77433c 100644 --- a/package.json +++ b/package.json @@ -41,10 +41,10 @@ "docs": "rm -rf docs/ && typedoc src/index.ts", "prepack": "npm run build", "pretest": "npm run build", - "test": "jest ./src/* && npm run test:loading", + "test": "jest --runInBand --collectCoverage ./src/* && npm run test:loading", "test:loading": "./test-module-loading.sh", - "test:e2e": "jest ./e2e/*", - "test:all": "jest", + "test:e2e": "jest --runInBand ./e2e/*", + "test:all": "jest --runInBand", "format": "eslint . --fix", "lint": "eslint ." },