Skip to content

Commit

Permalink
fix: use comma arrayFormat for fields param (#316)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpoehnelt committed Feb 8, 2020
1 parent 020045f commit f061eb7
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion e2e/places/details.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { placeDetails } from "../../src/places/details";
test("autocomplete should return correct result", async () => {
const params = {
place_id: "ChIJKxDbe_lYwokRVf__s8CPn-o",
key: process.env.GOOGLE_MAPS_API_KEY
key: process.env.GOOGLE_MAPS_API_KEY,
fields: ["place_id", "name", "formatted_address"]
};

const r = await placeDetails({ params: params });
Expand Down
2 changes: 1 addition & 1 deletion e2e/places/findplacefromtext.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ test("autocomplete should return correct result", async () => {
input: "Museum of Modern Art",
inputtype: PlaceInputType.textQuery,
key: process.env.GOOGLE_MAPS_API_KEY,
fields: ["place_id"]
fields: ["place_id", "name", "formatted_address"]
};

const r = await findPlaceFromText({ params: params });
Expand Down
6 changes: 5 additions & 1 deletion src/places/details.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ afterEach(() => {
});

test("autocomplete should call axios correctly", () => {
const params = { place_id: "notarealid", key: "foo" };
const params = {
place_id: "notarealid",
key: "foo",
fields: ["place_id", "name"]
};

placeDetails({ params: params }, mockedAxios);

Expand Down
2 changes: 1 addition & 1 deletion src/places/details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export type PlaceDetailsResponseStatus =
export const defaultUrl =
"https://maps.googleapis.com/maps/api/place/details/json";

export const defaultParamsSerializer = serializer({});
export const defaultParamsSerializer = serializer({}, {arrayFormat: "comma"});

export function placeDetails(
{
Expand Down
3 changes: 2 additions & 1 deletion src/places/findplacefromtext.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ test("autocomplete should call axios correctly", () => {
const params = {
input: "google",
inputtype: PlaceInputType.textQuery,
key: "foo"
key: "foo",
fields: ["place_id", "name"]
};

findPlaceFromText({ params: params }, mockedAxios);
Expand Down
2 changes: 1 addition & 1 deletion src/places/findplacefromtext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export interface FindPlaceFromTextResponse extends AxiosResponse {
export const defaultUrl =
"https://maps.googleapis.com/maps/api/place/findplacefromtext/json";

export const defaultParamsSerializer = serializer({});
export const defaultParamsSerializer = serializer({}, {arrayFormat: "comma"});

export function findPlaceFromText(
{
Expand Down

0 comments on commit f061eb7

Please sign in to comment.