Skip to content

Commit

Permalink
Merge pull request #36146 from JKobrynski/migrateGooglePlacesUtilsTes…
Browse files Browse the repository at this point in the history
…tToTypeScript
  • Loading branch information
blimpich authored Feb 20, 2024
2 parents 4ae7b29 + e98afd1 commit 00c5fd2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/libs/GooglePlacesUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ function getPlaceAutocompleteTerms(addressTerms: AddressTerm[]): GetPlaceAutocom
}

export {getAddressComponents, getPlaceAutocompleteTerms};
export type {AddressComponent, FieldsToExtract, AddressTerm};
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
import * as GooglePlacesUtils from '../../src/libs/GooglePlacesUtils';
/* eslint-disable @typescript-eslint/naming-convention */
import * as GooglePlacesUtils from '@src/libs/GooglePlacesUtils';
import type {AddressComponent, AddressTerm, FieldsToExtract} from '@src/libs/GooglePlacesUtils';

const standardObjectToFind = {
const standardObjectToFind: FieldsToExtract = {
sublocality: 'long_name',
administrative_area_level_1: 'short_name',
postal_code: 'long_name',
'doesnt-exist': 'long_name',
};

const objectWithCountryToFind = {
const objectWithCountryToFind: FieldsToExtract = {
sublocality: 'long_name',
administrative_area_level_1: 'short_name',
postal_code: 'long_name',
'doesnt-exist': 'long_name',
country: 'long_name',
};

const addressComponents = [
const addressComponents: AddressComponent[] = [
{
long_name: 'Bushwick',
short_name: 'Bushwick',
Expand Down Expand Up @@ -43,10 +45,7 @@ const addressComponents = [
},
];

const autoCompleteTerms = [
{offset: 0, value: 'Bangladesh Border Road'},
{offset: 24, value: 'Bangladesh'},
];
const autoCompleteTerms: AddressTerm[] = [{value: 'Bangladesh Border Road'}, {value: 'Bangladesh'}];

describe('GooglePlacesUtilsTest', () => {
describe('getAddressComponents', () => {
Expand Down

0 comments on commit 00c5fd2

Please sign in to comment.