Skip to content

Commit

Permalink
refactor(DTFS2-7121): lint
Browse files Browse the repository at this point in the history
  • Loading branch information
oscar-richardson-softwire committed May 20, 2024
1 parent 870616e commit 23dc7fc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
22 changes: 11 additions & 11 deletions src/modules/companies/companies.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,11 @@ describe('CompaniesService', () => {

const testRegistrationNumber = '00000001';

const {
getCompanyCompaniesHouseResponse,
findSectorIndustriesResponse,
getCompanyResponse,
getCompanyCompaniesHouseOverseasCompanyResponse,
} = new GetCompanyGenerator(valueGenerator).generate({
numberToGenerate: 1,
registrationNumber: testRegistrationNumber,
});
const { getCompanyCompaniesHouseResponse, findSectorIndustriesResponse, getCompanyResponse, getCompanyCompaniesHouseOverseasCompanyResponse } =
new GetCompanyGenerator(valueGenerator).generate({
numberToGenerate: 1,
registrationNumber: testRegistrationNumber,
});

beforeAll(() => {
const configService = new ConfigService();
Expand Down Expand Up @@ -96,8 +92,12 @@ describe('CompaniesService', () => {
});

it('throws an UnprocessableEntityException if the CompaniesHouseService returns an overseas company', async () => {
const companiesOverseasCompanyException = new CompaniesOverseasCompanyException(`Company with registration number ${testRegistrationNumber} is an overseas company. UKEF can only process applications from companies based in the UK.`);
when(companiesHouseServiceGetCompanyByRegistrationNumber).calledWith(testRegistrationNumber).mockReturnValueOnce(getCompanyCompaniesHouseOverseasCompanyResponse);
const companiesOverseasCompanyException = new CompaniesOverseasCompanyException(
`Company with registration number ${testRegistrationNumber} is an overseas company. UKEF can only process applications from companies based in the UK.`,
);
when(companiesHouseServiceGetCompanyByRegistrationNumber)
.calledWith(testRegistrationNumber)
.mockReturnValueOnce(getCompanyCompaniesHouseOverseasCompanyResponse);

const getCompanyPromise = service.getCompanyByRegistrationNumber(testRegistrationNumber);

Expand Down
4 changes: 3 additions & 1 deletion src/modules/companies/companies.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ export class CompaniesService {

private validateCompanyIsUkCompany(company: GetCompanyCompaniesHouseResponse, registrationNumber: string): never | undefined {
if (company.type.includes('oversea')) {
throw new CompaniesOverseasCompanyException(`Company with registration number ${registrationNumber} is an overseas company. UKEF can only process applications from companies based in the UK.`);
throw new CompaniesOverseasCompanyException(
`Company with registration number ${registrationNumber} is an overseas company. UKEF can only process applications from companies based in the UK.`,
);
}
}

Expand Down

0 comments on commit 23dc7fc

Please sign in to comment.