Skip to content

Commit

Permalink
feat(DTFS2-7052): actioning PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
avaitonis committed Apr 25, 2024
2 parents 7d15b07 + 708533b commit e012eb4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/modules/geospatial/geospatial.controller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ describe('GeospatialController', () => {
describe('getAddressesByPostcode()', () => {
const postcode = GEOSPATIAL.EXAMPLES.POSTCODE;

it('returns address for postcode', async () => {
it('returns a single address for the postcode when the service returns a single address', async () => {
when(geospatialServiceGetAddressesByPostcode).calledWith(postcode).mockResolvedValueOnce(getAddressByPostcodeResponse[0]);

const response = await controller.getAddressesByPostcode({ postcode });

expect(geospatialServiceGetAddressesByPostcode).toHaveBeenCalled();
expect(geospatialServiceGetAddressesByPostcode).toHaveBeenCalledTimes(1);
expect(response).toEqual(getAddressByPostcodeResponse[0]);
});

Expand Down
4 changes: 2 additions & 2 deletions src/modules/geospatial/geospatial.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ export class GeospatialController {
@Get('addresses/postcode')
@ApiOperation({
summary:
"A search based on a property's postcode. Will accept a full valid postcode. Returns addresses from Ordnance survey Delivery Point Address (DPA) system.",
"A search based on a property's postcode. Will accept a full valid postcode. Returns addresses from Ordnance Survey Delivery Point Address (DPA) system.",
})
@ApiResponse({
status: 200,
description: 'Returns simplified addresses that are ready to show to users.',
type: [GetAddressesResponseItem],
})
@ApiNotFoundResponse({
description: 'Customer not found.',
description: 'Postcode not found.',
})
getAddressesByPostcode(@Query() query: GetAddressesByPostcodeQueryDto): Promise<GetAddressesResponse> {
return this.geospatialService.getAddressesByPostcode(query.postcode);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/geospatial/geospatial.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe('GeospatialService', () => {
});

it('returns addressLine1 formatted correctly even if middle value is missing', async () => {
const [modifiedOrdnanceSurveyResponse] = getAddressOrdnanceSurveyResponse;
const [modifiedOrdnanceSurveyResponse] = structuredClone(getAddressOrdnanceSurveyResponse);
modifiedOrdnanceSurveyResponse.results[0].DPA.BUILDING_NUMBER = null;
const address = modifiedOrdnanceSurveyResponse.results[0].DPA;
when(ordnanceSurveyServiceGetAddressesByPostcode).calledWith(postcode).mockResolvedValueOnce(modifiedOrdnanceSurveyResponse);
Expand Down
4 changes: 2 additions & 2 deletions test/geospatial/get-address-by-postcode.api-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('GET /geospatial/addresses/postcode?postcode=', () => {
// MDM auth tests
withClientAuthenticationTests({
givenTheRequestWouldOtherwiseSucceed: () => {
requestToGetAddressesByPostcode(mdmPath[0]).reply(200, getAddressOrdnanceSurveyResponse[0]);
requestToGetAddressesByPostcode(ordnanceSurveyPath[0]).reply(200, getAddressOrdnanceSurveyResponse[0]);
},
makeRequestWithoutAuth: (incorrectAuth?: IncorrectAuthArg) => api.getWithoutAuth(mdmPath[0], incorrectAuth?.headerName, incorrectAuth?.headerValue),
});
Expand All @@ -67,7 +67,7 @@ describe('GET /geospatial/addresses/postcode?postcode=', () => {
expect(body).toStrictEqual(getAddressByPostcodeMultipleResponse);
});

it('returns a empty 200 response if Ordnance Survey API returns a 200 without results', async () => {
it('returns an empty 200 response if Ordnance Survey API returns a 200 without results', async () => {
requestToGetAddressesByPostcode(ordnanceSurveyPath[0]).reply(200, getAddressOrdnanceSurveyEmptyResponse[0]);

const { status, body } = await api.get(mdmPath[0]);
Expand Down

0 comments on commit e012eb4

Please sign in to comment.