diff --git a/src/index.ts b/src/index.ts index 08e1941d..d91c6992 100644 --- a/src/index.ts +++ b/src/index.ts @@ -24,6 +24,7 @@ import { Geocoder } from "./places/geocoder/geocoder"; import { Autocomplete } from "./places/autocomplete"; import { MaxZoomService } from "./drawing/max-zoom/max-zoom"; import { AutocompleteService } from "./places/autocomplete-service/autocomplete-service"; +import { AutocompleteSessionToken } from "./places/autocomplete-session-token/autocomplete-session-token"; import { DistanceMatrixService } from "./routes/distance-matrix-service/distance-matrix-service"; import { ElevationService } from "./routes/elevation-service/elevation-service"; import { Circle } from "./drawing/polygons/circle"; @@ -91,6 +92,7 @@ const initialize = function (): void { SearchBox: SearchBox, PlacesService, AutocompleteService, + AutocompleteSessionToken, }, Geocoder, Polygon: Polygon, @@ -120,6 +122,7 @@ export { Autocomplete, PlacesService, AutocompleteService, + AutocompleteSessionToken, Geocoder, Circle, Data, diff --git a/src/places/autocomplete-session-token/autocomplete-session-token.test.ts b/src/places/autocomplete-session-token/autocomplete-session-token.test.ts new file mode 100644 index 00000000..921e913e --- /dev/null +++ b/src/places/autocomplete-session-token/autocomplete-session-token.test.ts @@ -0,0 +1,36 @@ +/** + * Copyright 2023 Google LLC. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { + AutocompleteSessionToken, + initialize, + mockInstances, +} from "../../index"; + +beforeEach(initialize); + +test("autocomplete session token is mocked", async () => { + const token = new google.maps.places.AutocompleteSessionToken(); + + expect(token).toBeTruthy(); +}); + +test("register mocks", () => { + new google.maps.places.AutocompleteSessionToken(); + const mocks = mockInstances.get(AutocompleteSessionToken); + + expect(mocks).toHaveLength(1); +}); diff --git a/src/places/autocomplete-session-token/autocomplete-session-token.ts b/src/places/autocomplete-session-token/autocomplete-session-token.ts new file mode 100644 index 00000000..04eac279 --- /dev/null +++ b/src/places/autocomplete-session-token/autocomplete-session-token.ts @@ -0,0 +1,25 @@ +/** + * Copyright 2023 Google LLC. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { __registerMockInstance } from "../../registry"; + +export class AutocompleteSessionToken + implements google.maps.places.AutocompleteSessionToken +{ + constructor() { + __registerMockInstance(this.constructor, this); + } +}