Skip to content

Commit

Permalink
chore(geo): release @aws-amplify/geo@geo 9/13/21 (#8887)
Browse files Browse the repository at this point in the history
* feat(geo): add region to Amazon Location Service MapStyle (#8736)

BREAKING CHANGE: update name for amazon location service provider (#8872)
  • Loading branch information
TreTuna committed Sep 23, 2021
1 parent 21c95b2 commit 769dc02
Show file tree
Hide file tree
Showing 13 changed files with 112 additions and 91 deletions.
6 changes: 3 additions & 3 deletions packages/core/__tests__/parseMobileHubConfig-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('Parser', () => {
aws_user_pools_web_client_id: '',
aws_cognito_region: '',
geo: {
amazon_location_services: {
amazon_location_service: {
maps: {
items: {
geoJsExampleMap1: {
Expand Down Expand Up @@ -48,7 +48,7 @@ describe('Parser', () => {
userPoolWebClientId: '',
},
Geo: {
AmazonLocationServices: {
AmazonLocationService: {
maps: {
items: {
geoJsExampleMap1: {
Expand Down Expand Up @@ -76,7 +76,7 @@ describe('Parser', () => {
aws_user_pools_id: 'b',
aws_user_pools_web_client_id: '',
geo: {
amazon_location_services: {
amazon_location_service: {
maps: {
items: {
geoJsExampleMap1: {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/Parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ export const parseMobileHubConfig = (config): AmplifyConfig => {
// Geo
if (config['geo']) {
amplifyConfig.Geo = Object.assign({}, config.geo);
if (config.geo['amazon_location_services']) {
if (config.geo['amazon_location_service']) {
amplifyConfig.Geo = {
AmazonLocationServices: config.geo['amazon_location_services'],
AmazonLocationService: config.geo['amazon_location_service'],
};
}
}
Expand Down
18 changes: 18 additions & 0 deletions packages/geo/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# 0.0.2-geo.6654 (2021-09-13)

### Features
Add region to Amazon Location Service MapStyle (#8736) (#8745)

### Bug fixes
Update webpack config to mark core as external (#8748)

### BREAKING CHANGES

* Rename all instances of Amazon Location Services to the singular Amazon Location Service
* Update name for amazon location service provider (#8872)
* All methods and variable instances of the same
35 changes: 17 additions & 18 deletions packages/geo/__tests__/Geo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
} from '@aws-sdk/client-location';

import { GeoClass } from '../src/Geo';
import { AmazonLocationServicesProvider } from '../src/Providers/AmazonLocationServicesProvider';
import { AmazonLocationServiceProvider } from '../src/Providers/AmazonLocationServiceProvider';
import { SearchByTextOptions } from '../src/types';

import {
Expand Down Expand Up @@ -65,17 +65,17 @@ describe('Geo', () => {
describe('pluggables', () => {
test('getPluggable', () => {
const geo = new GeoClass();
const provider = new AmazonLocationServicesProvider();
const provider = new AmazonLocationServiceProvider();
geo.addPluggable(provider);

expect(geo.getPluggable(provider.getProviderName())).toBeInstanceOf(
AmazonLocationServicesProvider
AmazonLocationServiceProvider
);
});

test('removePluggable', () => {
const geo = new GeoClass();
const provider = new AmazonLocationServicesProvider();
const provider = new AmazonLocationServiceProvider();
geo.addPluggable(provider);
geo.removePluggable(provider.getProviderName());

Expand All @@ -85,12 +85,12 @@ describe('Geo', () => {
});
});

describe('AmazonLocationServices is used as default provider', () => {
describe('AmazonLocationService is used as default provider', () => {
test('creates the proper default provider', () => {
const geo = new GeoClass();
geo.configure(awsConfig);
expect(geo.getPluggable('AmazonLocationServices')).toBeInstanceOf(
AmazonLocationServicesProvider
expect(geo.getPluggable('AmazonLocationService')).toBeInstanceOf(
AmazonLocationServiceProvider
);
});
});
Expand All @@ -101,7 +101,7 @@ describe('Geo', () => {
const config = geo.configure(awsConfig);
const expected = {
...awsConfig,
AmazonLocationServices: awsConfig.geo.amazon_location_services,
AmazonLocationService: awsConfig.geo.amazon_location_service,
};
expect(config).toEqual(expected);
});
Expand All @@ -115,7 +115,7 @@ describe('Geo', () => {

const geo = new GeoClass();
geo.configure(awsConfig);
geo.removePluggable('AmazonLocationServices');
geo.removePluggable('AmazonLocationService');

expect(() => geo.getAvailableMaps()).toThrow(
'No plugin found in Geo for the provider'
Expand All @@ -139,8 +139,8 @@ describe('Geo', () => {
geo.configure(awsConfig);

const maps = [];
const availableMaps = awsConfig.geo.amazon_location_services.maps.items;
const region = awsConfig.geo.amazon_location_services.region;
const availableMaps = awsConfig.geo.amazon_location_service.maps.items;
const region = awsConfig.geo.amazon_location_service.region;

for (const mapName in availableMaps) {
const style = availableMaps[mapName].style;
Expand All @@ -163,7 +163,7 @@ describe('Geo', () => {
const geo = new GeoClass();
geo.configure({
geo: {
amazon_location_services: {
amazon_location_service: {
maps: { items: { testMap: { style: 'teststyle' } } },
},
},
Expand All @@ -178,10 +178,10 @@ describe('Geo', () => {
const geo = new GeoClass();
geo.configure(awsConfig);

const mapName = awsConfig.geo.amazon_location_services.maps.default;
const mapName = awsConfig.geo.amazon_location_service.maps.default;
const style =
awsConfig.geo.amazon_location_services.maps.items[mapName].style;
const region = awsConfig.geo.amazon_location_services.region;
awsConfig.geo.amazon_location_service.maps.items[mapName].style;
const region = awsConfig.geo.amazon_location_service.region;
const testMap = { mapName, style, region };

const defaultMapsResource = geo.getDefaultMap();
Expand All @@ -207,8 +207,7 @@ describe('Geo', () => {
const input = spyon.mock.calls[0][0].input;
expect(input).toEqual({
Text: testString,
IndexName:
awsConfig.geo.amazon_location_services.search_indices.default,
IndexName: awsConfig.geo.amazon_location_service.search_indices.default,
});
});

Expand Down Expand Up @@ -277,7 +276,7 @@ describe('Geo', () => {

const geo = new GeoClass();
geo.configure(awsConfig);
geo.removePluggable('AmazonLocationServices');
geo.removePluggable('AmazonLocationService');

const testString = 'starbucks';
await expect(geo.searchByText(testString)).rejects.toThrow(
Expand Down

0 comments on commit 769dc02

Please sign in to comment.