Skip to content

Commit

Permalink
fix(EMS-3436-3448): no pdf - application submission - XLSX - content …
Browse files Browse the repository at this point in the history
…mapping issues (#2547)

* fix(EMS-3436-3448): no pdf - application submission - xlsx mapping issues

* fix(EMS-3436-3448): fix typo
  • Loading branch information
ttbarnes authored Jun 7, 2024
1 parent e85b2f8 commit abc8b51
Show file tree
Hide file tree
Showing 14 changed files with 145 additions and 19 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,17 +200,19 @@ jobs:
"account/sign-in/**/*.spec.js",
"account/sign-out/**/*.spec.js",
"account/suspended/**/*.spec.js",
"application-submission/*.spec.js",
"application-submission/multiple-policy-type/*.spec.js",
"application-submission/multiple-policy-type/business-conditions/*.spec.js",
"application-submission/multiple-policy-type/buyer-conditions/*.spec.js",
"application-submission/multiple-policy-type/buyer-conditions/traded-with-buyer/*.spec.js",
"application-submission/multiple-policy-type/declarations-conditions/*.spec.js",
"application-submission/multiple-policy-type/export-contract-conditions/*.spec.js",
"application-submission/multiple-policy-type/policy-conditions/*.spec.js",

"application-submission/single-policy-type/*.spec.js",
"application-submission/single-policy-type/business-conditions/*.spec.js",
"application-submission/single-policy-type/buyer-conditions/*.spec.js",
"application-submission/single-policy-type/buyer-conditions/traded-with-buyer/*.spec.js",
"application-submission/single-policy-type/declarations-conditions/*.spec.js",
"application-submission/single-policy-type/export-contract-conditions/*.spec.js",
"application-submission/single-policy-type/policy-conditions/*.spec.js",
"cannot-skip-flow/**/*.spec.js",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { APPLICATION } from '../../../../../../../constants';

context(
'Insurance - submit an application, Multiple contract policy, no broker, no `have traded with buyer before` and no `have code of conduct` declaration',
() => {
let referenceNumber;

before(() => {
cy.createAccount({});
});

beforeEach(() => {
cy.saveSession();

cy.completeSignInAndSubmitAnApplication({
policyType: APPLICATION.POLICY_TYPE.MULTIPLE,
exporterHasTradedWithBuyer: false,
hasAntiBriberyCodeOfConduct: false,
exportingWithCodeOfConduct: false,
}).then((refNumber) => {
referenceNumber = refNumber;
});
});

after(() => {
cy.deleteApplication(referenceNumber);
});

it('should successfully submit the application and redirect to `application submitted`', () => {
cy.assertApplicationSubmittedUrl(referenceNumber);
});
},
);
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
context('Insurance - submit an application, no broker, no `have traded with buyer before` and no `have code of conduct` declaration', () => {
import { APPLICATION } from '../../../../../../../constants';

context('Insurance - submit an application - Multiple policy type, without `have code of conduct` declaration', () => {
let referenceNumber;

before(() => {
cy.createAccount({});
});

beforeEach(() => {
cy.saveSession();

cy.completeSignInAndSubmitAnApplication({
exporterHasTradedWithBuyer: false,
policyType: APPLICATION.POLICY_TYPE.MULTIPLE,
hasAntiBriberyCodeOfConduct: false,
exportingWithCodeOfConduct: false,
}).then((refNumber) => {
referenceNumber = refNumber;
});
});

beforeEach(() => {
cy.saveSession();
});

after(() => {
cy.deleteApplication(referenceNumber);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { APPLICATION } from '../../../../../../../constants';

context('Insurance - submit an application - Multiple policy type, without `exporting with code of conduct` declaration', () => {
let referenceNumber;

before(() => {
cy.completeSignInAndSubmitAnApplication({
policyType: APPLICATION.POLICY_TYPE.MULTIPLE,
exportingWithCodeOfConduct: false,
}).then((refNumber) => {
referenceNumber = refNumber;
});
});

beforeEach(() => {
cy.saveSession();
});

after(() => {
cy.deleteApplication(referenceNumber);
});

it('should successfully submit the application and redirect to `application submitted`', () => {
cy.assertApplicationSubmittedUrl(referenceNumber);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { APPLICATION } from '../../../../../../../constants';

context('Insurance - submit an application - Multiple policy type, with a different `name on policy`', () => {
let referenceNumber;

before(() => {
cy.completeSignInAndSubmitAnApplication({
policyType: APPLICATION.POLICY_TYPE.MULTIPLE,
differentPolicyContact: true,
}).then((refNumber) => {
referenceNumber = refNumber;
});
});

beforeEach(() => {
cy.saveSession();
});

after(() => {
cy.deleteApplication(referenceNumber);
});

it('should successfully submit the application and redirect to `application submitted`', () => {
cy.assertApplicationSubmittedUrl(referenceNumber);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
context(
'Insurance - submit an application, Single contract policy, no broker, no `have traded with buyer before` and no `have code of conduct` declaration',
() => {
let referenceNumber;

before(() => {
cy.createAccount({});
});

beforeEach(() => {
cy.saveSession();

cy.completeSignInAndSubmitAnApplication({
exporterHasTradedWithBuyer: false,
hasAntiBriberyCodeOfConduct: false,
exportingWithCodeOfConduct: false,
}).then((refNumber) => {
referenceNumber = refNumber;
});
});

after(() => {
cy.deleteApplication(referenceNumber);
});

it('should successfully submit the application and redirect to `application submitted`', () => {
cy.assertApplicationSubmittedUrl(referenceNumber);
});
},
);
16 changes: 11 additions & 5 deletions src/api/.keystone/config.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/api/content-strings/XLSX.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const {
DECLARATIONS: { AGREE_HOW_YOUR_DATA_WILL_BE_USED, HAS_ANTI_BRIBERY_CODE_OF_CONDUCT, WILL_EXPORT_WITH_CODE_OF_CONDUCT },
ELIGIBILITY: { BUYER_COUNTRY, COMPANIES_HOUSE_NUMBER, COVER_PERIOD, HAS_END_BUYER, HAS_MINIMUM_UK_GOODS_OR_SERVICES },
EXPORTER_BUSINESS: {
COMPANIES_HOUSE: { COMPANY_ADDRESS: EXPORTER_COMPANY_ADDRESS, COMPANY_SIC: EXPORTER_COMPANY_SIC },
COMPANIES_HOUSE: { COMPANY_ADDRESS: EXPORTER_COMPANY_ADDRESS, COMPANY_NAME: EXPORTER_COMPANY_NAME, COMPANY_SIC: EXPORTER_COMPANY_SIC },
YOUR_COMPANY: { HAS_DIFFERENT_TRADING_NAME, DIFFERENT_TRADING_NAME, PHONE_NUMBER, TRADING_ADDRESS, WEBSITE },
NATURE_OF_YOUR_BUSINESS: { GOODS_OR_SERVICES, YEARS_EXPORTING, EMPLOYEES_UK },
TURNOVER: { ESTIMATED_ANNUAL_TURNOVER },
Expand Down Expand Up @@ -76,6 +76,7 @@ export const XLSX = {
[HAS_CREDIT_CONTROL]: 'Do you have a process for dealing with late payments',
[CONTRACT_COMPLETION_DATE]: 'Date expected for contract to complete',
[EXPORTER_COMPANY_ADDRESS]: 'Exporter registered office address',
[EXPORTER_COMPANY_NAME]: 'Exporter company name',
[EXPORTER_COMPANY_SIC]: 'Exporter standard industry classification (SIC) codes and nature of business',
[HAS_DIFFERENT_TRADING_NAME]: 'Different trading name?',
[DIFFERENT_TRADING_NAME]: 'Alternative trading name',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const { KEY, VALUE } = XLSX_CONFIG;
* @returns {Object}
*/
const xlsxRow = (fieldName: string, answer?: string | number) => {
console.info('Mapping XLSX row %s', fieldName);

const value = answer || answer === 0 ? answer : '';

const cleanValue = replaceCharacterCodesWithCharacters(String(value));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ describe('api/generate-xlsx/map-application-to-xlsx/map-declarations', () => {
xlsxRow(SECTION_TITLES.DECLARATIONS, ''),
xlsxRow(CONTENT_STRINGS[AGREE_CONFIDENTIALITY].SUMMARY.TITLE, mapAgreedField(declaration[AGREE_CONFIDENTIALITY])),
xlsxRow(CONTENT_STRINGS[AGREE_ANTI_BRIBERY].SUMMARY.TITLE, mapAgreedField(declaration[AGREE_ANTI_BRIBERY])),
xlsxRow(String(FIELDS[HAS_ANTI_BRIBERY_CODE_OF_CONDUCT]), mapYesNoField(declaration[HAS_ANTI_BRIBERY_CODE_OF_CONDUCT])),
xlsxRow(String(FIELDS[WILL_EXPORT_WITH_CODE_OF_CONDUCT]), mapYesNoField(declaration[WILL_EXPORT_WITH_CODE_OF_CONDUCT])),
xlsxRow(String(FIELDS[HAS_ANTI_BRIBERY_CODE_OF_CONDUCT]), mapYesNoField({ answer: declaration[HAS_ANTI_BRIBERY_CODE_OF_CONDUCT] })),
xlsxRow(String(FIELDS[WILL_EXPORT_WITH_CODE_OF_CONDUCT]), mapYesNoField({ answer: declaration[WILL_EXPORT_WITH_CODE_OF_CONDUCT] })),
xlsxRow(String(FIELDS[AGREE_HOW_YOUR_DATA_WILL_BE_USED]), mapAgreedField(declaration[AGREE_HOW_YOUR_DATA_WILL_BE_USED])),
xlsxRow(CONTENT_STRINGS[AGREE_CONFIRMATION_ACKNOWLEDGEMENTS].SUMMARY.TITLE, mapAgreedField(declaration[AGREE_CONFIRMATION_ACKNOWLEDGEMENTS])),
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ const mapDeclarations = (application: Application) => {
xlsxRow(SECTION_TITLES.DECLARATIONS, ''),
xlsxRow(CONTENT_STRINGS[AGREE_CONFIDENTIALITY].SUMMARY.TITLE, mapAgreedField(declaration[AGREE_CONFIDENTIALITY])),
xlsxRow(CONTENT_STRINGS[AGREE_ANTI_BRIBERY].SUMMARY.TITLE, mapAgreedField(declaration[AGREE_ANTI_BRIBERY])),
xlsxRow(String(FIELDS[HAS_ANTI_BRIBERY_CODE_OF_CONDUCT]), mapYesNoField(declaration[HAS_ANTI_BRIBERY_CODE_OF_CONDUCT])),
xlsxRow(String(FIELDS[WILL_EXPORT_WITH_CODE_OF_CONDUCT]), mapYesNoField(declaration[WILL_EXPORT_WITH_CODE_OF_CONDUCT])),
xlsxRow(String(FIELDS[HAS_ANTI_BRIBERY_CODE_OF_CONDUCT]), mapYesNoField({ answer: declaration[HAS_ANTI_BRIBERY_CODE_OF_CONDUCT] })),
xlsxRow(String(FIELDS[WILL_EXPORT_WITH_CODE_OF_CONDUCT]), mapYesNoField({ answer: declaration[WILL_EXPORT_WITH_CODE_OF_CONDUCT] })),
xlsxRow(String(FIELDS[AGREE_HOW_YOUR_DATA_WILL_BE_USED]), mapAgreedField(declaration[AGREE_HOW_YOUR_DATA_WILL_BE_USED])),
xlsxRow(CONTENT_STRINGS[AGREE_CONFIRMATION_ACKNOWLEDGEMENTS].SUMMARY.TITLE, mapAgreedField(declaration[AGREE_CONFIRMATION_ACKNOWLEDGEMENTS])),
];
Expand Down

0 comments on commit abc8b51

Please sign in to comment.