Skip to content

Commit

Permalink
manual fix for linting
Browse files Browse the repository at this point in the history
  • Loading branch information
ashika112 committed May 28, 2024
1 parent 7ec6b28 commit 54e1892
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 33 deletions.
7 changes: 0 additions & 7 deletions packages/geo/__tests__/Geo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,6 @@ describe('Geo', () => {
jest.clearAllMocks();
});

describe('constructor', () => {
test('happy case', () => {
(Amplify.getConfig as jest.Mock).mockReturnValue(awsConfigGeoV4);
const geo = new GeoClass();
});
});

describe('getModuleName', () => {
(Amplify.getConfig as jest.Mock).mockReturnValue(awsConfigGeoV4);
const geo = new GeoClass();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,6 @@ describe('AmazonLocationServiceProvider', () => {
(Amplify.getConfig as jest.Mock).mockReturnValue(awsConfigGeoV4);
});

describe('constructor', () => {
test('happy case', () => {
const provider = new AmazonLocationServiceProvider();
});
});

describe('getCategory', () => {
test('should return "Geo" when asked for category', () => {
const geo = new AmazonLocationServiceProvider();
Expand Down Expand Up @@ -311,9 +305,7 @@ describe('AmazonLocationServiceProvider', () => {
});

test('should fail if _getCredentials fails ', async () => {
(fetchAuthSession as jest.Mock).mockImplementationOnce(() => {
return Promise.reject();
});
(fetchAuthSession as jest.Mock).mockRejectedValueOnce('Auth Error');

const locationProvider = new AmazonLocationServiceProvider();

Expand Down Expand Up @@ -477,9 +469,7 @@ describe('AmazonLocationServiceProvider', () => {
});

test('should fail if _getCredentials fails ', async () => {
(fetchAuthSession as jest.Mock).mockImplementationOnce(() => {
return Promise.reject();
});
(fetchAuthSession as jest.Mock).mockRejectedValueOnce('Auth Error');

const locationProvider = new AmazonLocationServiceProvider();

Expand Down Expand Up @@ -560,9 +550,7 @@ describe('AmazonLocationServiceProvider', () => {
});

test('should fail if _getCredentials fails ', async () => {
(fetchAuthSession as jest.Mock).mockImplementationOnce(() => {
return Promise.reject();
});
(fetchAuthSession as jest.Mock).mockRejectedValueOnce('Auth Error');

const locationProvider = new AmazonLocationServiceProvider();

Expand Down Expand Up @@ -656,9 +644,7 @@ describe('AmazonLocationServiceProvider', () => {
});

test('should fail if _getCredentials fails ', async () => {
(fetchAuthSession as jest.Mock).mockImplementationOnce(() => {
return Promise.reject();
});
(fetchAuthSession as jest.Mock).mockRejectedValueOnce('Auth Error');

const locationProvider = new AmazonLocationServiceProvider();

Expand Down Expand Up @@ -781,13 +767,13 @@ describe('AmazonLocationServiceProvider', () => {
});

const results = await locationProvider.saveGeofences(input);
const badResults = input.slice(20, 30).map(input => {
const badResults = input.slice(20, 30).map(result => {
return {
error: {
code: 'APIConnectionError',
message: 'Bad network call',
},
geofenceId: input.geofenceId,
geofenceId: result.geofenceId,
};
});
const expected = {
Expand Down Expand Up @@ -887,7 +873,7 @@ describe('AmazonLocationServiceProvider', () => {
status: 'ACTIVE',
};

await expect(results).toEqual(expected);
expect(results).toEqual(expected);
});

test('getGeofence errors when a bad geofenceId is given', async () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/geo/__tests__/testData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export const validCoordinates4: Coordinates = [
-123.14909934997559, 49.29132171993048,
];
export const validCoordinates5: Coordinates = [
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision
-123.14695358276361, 49.290090146520431,
];

Expand Down Expand Up @@ -239,7 +240,7 @@ export const singleGeofenceCamelcaseResults = {
};

export const batchGeofencesCamelcaseResults = {
successes: validGeofences.map(({ geofenceId }, i) => {
successes: validGeofences.map(({ geofenceId }) => {
return {
createTime: '2020-04-01T21:00:00.000Z',
updateTime: '2020-04-01T21:00:00.000Z',
Expand Down
10 changes: 6 additions & 4 deletions packages/geo/__tests__/util.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ describe('Geo utility functions', () => {

describe('validateLinearRing', () => {
test('should not throw an error for a valid LinearRing', () => {
const result = validateLinearRing(validLinearRing);
expect(() => result).not.toThrow();
expect(() => {
validateLinearRing(validLinearRing);
}).not.toThrow();
});
test('should error if first and last coordinates do not match', () => {
expect(() => {
Expand Down Expand Up @@ -181,8 +182,9 @@ describe('Geo utility functions', () => {

describe('validateGeofencesInput', () => {
test('should not throw an error for valid geofences', () => {
const result = validateGeofencesInput(validGeofences);
expect(() => result).not.toThrow();
expect(() => {
validateGeofencesInput(validGeofences);
}).not.toThrow();
});
test('should error if a geofenceId is not unique', () => {
expect(() => {
Expand Down

0 comments on commit 54e1892

Please sign in to comment.