From 7d15b07ef4126f99ffcf6189deac2b2391633edd Mon Sep 17 00:00:00 2001 From: Audrius Vaitonis Date: Thu, 25 Apr 2024 10:49:50 +0100 Subject: [PATCH] feat(DTFS2-7052): actioning PR comments --- .../geospatial/dto/get-addresses-response.dto.ts | 3 ++- src/modules/geospatial/geospatial.service.test.ts | 14 +++++++------- src/modules/mdm.module.ts | 3 --- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/modules/geospatial/dto/get-addresses-response.dto.ts b/src/modules/geospatial/dto/get-addresses-response.dto.ts index 7bd22301..87e997a1 100644 --- a/src/modules/geospatial/dto/get-addresses-response.dto.ts +++ b/src/modules/geospatial/dto/get-addresses-response.dto.ts @@ -32,8 +32,9 @@ export class GetAddressesResponseItem { readonly addressLine3: string | null; @ApiProperty({ - description: 'Locality, Town', + description: 'Locality or town', example: GEOSPATIAL.EXAMPLES.LOCALITY, + nullable: true, }) readonly locality: string | null; diff --git a/src/modules/geospatial/geospatial.service.test.ts b/src/modules/geospatial/geospatial.service.test.ts index 2b34b577..a656837d 100644 --- a/src/modules/geospatial/geospatial.service.test.ts +++ b/src/modules/geospatial/geospatial.service.test.ts @@ -13,16 +13,16 @@ describe('GeospatialService', () => { let service: GeospatialService; let configServiceGet: jest.Mock; - let informaticaServiceGetAddressesByPostcode: jest.Mock; + let ordnanceSurveyServiceGetAddressesByPostcode: jest.Mock; beforeEach(() => { const configService = new ConfigService(); configServiceGet = jest.fn().mockReturnValue({ key: valueGenerator.word() }); configService.get = configServiceGet; - informaticaServiceGetAddressesByPostcode = jest.fn(); + ordnanceSurveyServiceGetAddressesByPostcode = jest.fn(); const ordnanceSurveyService = new OrdnanceSurveyService(null, configService); - ordnanceSurveyService.getAddressesByPostcode = informaticaServiceGetAddressesByPostcode; + ordnanceSurveyService.getAddressesByPostcode = ordnanceSurveyServiceGetAddressesByPostcode; resetAllWhenMocks(); service = new GeospatialService(ordnanceSurveyService); @@ -41,7 +41,7 @@ describe('GeospatialService', () => { const postcode = getAddressByPostcodeResponse[0][0].postalCode; it('returns a single address from the backend service', async () => { - when(informaticaServiceGetAddressesByPostcode).calledWith(postcode).mockResolvedValueOnce(getAddressOrdnanceSurveyResponse[0]); + when(ordnanceSurveyServiceGetAddressesByPostcode).calledWith(postcode).mockResolvedValueOnce(getAddressOrdnanceSurveyResponse[0]); const response = await service.getAddressesByPostcode(postcode); @@ -49,7 +49,7 @@ describe('GeospatialService', () => { }); it('returns multiple addressess from the backend service', async () => { - when(informaticaServiceGetAddressesByPostcode).calledWith(postcode).mockResolvedValueOnce(getAddressOrdnanceSurveyMultipleResponse); + when(ordnanceSurveyServiceGetAddressesByPostcode).calledWith(postcode).mockResolvedValueOnce(getAddressOrdnanceSurveyMultipleResponse); const response = await service.getAddressesByPostcode(postcode); @@ -57,7 +57,7 @@ describe('GeospatialService', () => { }); it('can handle empty backend response', async () => { - when(informaticaServiceGetAddressesByPostcode).calledWith(postcode).mockResolvedValueOnce(getAddressOrdnanceSurveyEmptyResponse[0]); + when(ordnanceSurveyServiceGetAddressesByPostcode).calledWith(postcode).mockResolvedValueOnce(getAddressOrdnanceSurveyEmptyResponse[0]); const response = await service.getAddressesByPostcode(postcode); @@ -68,7 +68,7 @@ describe('GeospatialService', () => { const [modifiedOrdnanceSurveyResponse] = getAddressOrdnanceSurveyResponse; modifiedOrdnanceSurveyResponse.results[0].DPA.BUILDING_NUMBER = null; const address = modifiedOrdnanceSurveyResponse.results[0].DPA; - when(informaticaServiceGetAddressesByPostcode).calledWith(postcode).mockResolvedValueOnce(modifiedOrdnanceSurveyResponse); + when(ordnanceSurveyServiceGetAddressesByPostcode).calledWith(postcode).mockResolvedValueOnce(modifiedOrdnanceSurveyResponse); const response = await service.getAddressesByPostcode(postcode); diff --git a/src/modules/mdm.module.ts b/src/modules/mdm.module.ts index 9d3b7bfb..790a1510 100644 --- a/src/modules/mdm.module.ts +++ b/src/modules/mdm.module.ts @@ -1,7 +1,6 @@ import { Module } from '@nestjs/common'; import { AuthModule } from '@ukef/auth/auth.module'; import { DatabaseModule } from '@ukef/database/database.module'; -import { OrdnanceSurveyModule } from '@ukef/helper-modules/ordnance-survey/ordnance-survey.module'; import { CurrenciesModule } from '@ukef/modules/currencies/currencies.module'; import { CustomersModule } from '@ukef/modules/customers/customers.module'; import { ExposurePeriodModule } from '@ukef/modules/exposure-period/exposure-period.module'; @@ -28,7 +27,6 @@ import { YieldRatesModule } from '@ukef/modules/yield-rates/yield-rates.module'; PremiumSchedulesModule, SectorIndustriesModule, YieldRatesModule, - OrdnanceSurveyModule, GeospatialModule, ], exports: [ @@ -44,7 +42,6 @@ import { YieldRatesModule } from '@ukef/modules/yield-rates/yield-rates.module'; PremiumSchedulesModule, SectorIndustriesModule, YieldRatesModule, - OrdnanceSurveyModule, GeospatialModule, ], })