Skip to content

Commit

Permalink
migrate GooglePlacesUtilsTest to TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
JKobrynski committed Feb 8, 2024
1 parent 02f0613 commit 0052fae
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 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 @@
/* 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 0052fae

Please sign in to comment.