Skip to content

Commit 1be71ac

Browse files
authored
test: fix places/photo test (#1113)
1 parent 52b256f commit 1be71ac

3 files changed

Lines changed: 19 additions & 8 deletions

File tree

e2e/places/photo.test.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,25 @@
1515
*/
1616

1717
import { placePhoto } from "../../src/places/photo";
18+
import { placeDetails } from "../../src/places/details";
1819

1920
test("photo should return correct result", async () => {
21+
const placeDetailsResponse = await placeDetails({
22+
params: {
23+
// The Museum of Modern Art, 11 W 53rd St, New York
24+
place_id: "ChIJKxDbe_lYwokRVf__s8CPn-o",
25+
key: process.env.GOOGLE_MAPS_API_KEY,
26+
fields: ["place_id", "photo"],
27+
},
28+
});
29+
30+
const [photo] = placeDetailsResponse.data.result.photos;
31+
const { photo_reference: photoreference } = photo;
32+
2033
const params = {
21-
photoreference:
22-
"AZose0kqzNAxzQSLYC-kxAidG_FkCelqG6lXa-05yhbKfwfGd0Agu4YXSjvArtNEYLC8CiCvQb4uxQzfn2fZi2kzxeMBgtOHmbo0c8eqMx_YPVNRCjjPL_kA77NOWF5wOS2ub6ZQlM0G8XibN93burBky0JLCE5sf-C6gLVEG74yiPYoK8id",
23-
maxwidth: 100,
24-
maxheight: 100,
34+
photoreference,
35+
maxwidth: 1000,
36+
maxheight: 1000,
2537
key: process.env.GOOGLE_MAPS_API_KEY,
2638
};
2739
const r = await placePhoto({ params: params, responseType: "arraybuffer" });

jest.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,5 @@ module.exports = {
2222
transformIgnorePatterns: [
2323
"/node_modules/(?!(axios|retry-axios|query-string|decode-uri-component|split-on-first|filter-obj)/)",
2424
],
25-
collectCoverage: true,
2625
collectCoverageFrom: ["src/**/([a-zA-Z_]*).{js,ts}", "!**/*.test.{js,ts}"],
2726
};

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@
4141
"docs": "rm -rf docs/ && typedoc src/index.ts",
4242
"prepack": "npm run build",
4343
"pretest": "npm run build",
44-
"test": "jest ./src/* && npm run test:loading",
44+
"test": "jest --runInBand --collectCoverage ./src/* && npm run test:loading",
4545
"test:loading": "./test-module-loading.sh",
46-
"test:e2e": "jest ./e2e/*",
47-
"test:all": "jest",
46+
"test:e2e": "jest --runInBand ./e2e/*",
47+
"test:all": "jest --runInBand",
4848
"format": "eslint . --fix",
4949
"lint": "eslint ."
5050
},

0 commit comments

Comments
 (0)