Skip to content

Commit

Permalink
feat(EMS-3709-10): code and test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zain Kassam committed Aug 6, 2024
1 parent 1d55b55 commit e32de81
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ context(
beforeEach(() => {
cy.navigateToUrl(url);

// change to DIRECT_AWARD
// select DIRECT_AWARD
summaryList.field(FIELD_ID).changeLink().click();
cy.completeAndSubmitHowWasTheContractAwardedForm({ directAward: true });

// change back to OTHER
// select OTHER
summaryList.field(FIELD_ID).changeLink().click();
const selector = radios(OTHER.ID).option;
selector.label().click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const task = taskList.submitApplication.tasks.checkAnswers;
const baseUrl = Cypress.config('baseUrl');

context(
'Insurance - Check your answers - Export contract - Summary list - Contract awarded competitive bidding - As an exporter, I want to be able to review my input for the export contract again, So that I can do a final review of the information I previously input before submitting my application',
`Insurance - Check your answers - Export contract - Summary list - Contract awarded ${COMPETITIVE_BIDDING.TEXT} - As an exporter, I want to be able to review my input for the export contract again, So that I can do a final review of the information I previously input before submitting my application`,
() => {
let referenceNumber;
let url;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const task = taskList.submitApplication.tasks.checkAnswers;
const baseUrl = Cypress.config('baseUrl');

context(
'Insurance - Check your answers - Export contract - Summary list - Contract awarded direct award - As an exporter, I want to be able to review my input for the export contract again, So that I can do a final review of the information I previously input before submitting my application',
`Insurance - Check your answers - Export contract - Summary list - Contract awarded ${DIRECT_AWARD.TEXT} - As an exporter, I want to be able to review my input for the export contract again, So that I can do a final review of the information I previously input before submitting my application`,
() => {
let referenceNumber;
let url;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const task = taskList.submitApplication.tasks.checkAnswers;
const baseUrl = Cypress.config('baseUrl');

context(
'Insurance - Check your answers - Export contract - Summary list - Contract awarded negotiated contract - As an exporter, I want to be able to review my input for the export contract again, So that I can do a final review of the information I previously input before submitting my application',
`Insurance - Check your answers - Export contract - Summary list - Contract awarded ${NEGOTIATED_CONTRACT.TEXT} - As an exporter, I want to be able to review my input for the export contract again, So that I can do a final review of the information I previously input before submitting my application`,
() => {
let referenceNumber;
let url;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,27 @@ import { INSURANCE_ROUTES } from '../../../../../../../constants/routes/insuranc
import { assertMinimalExportContractSummaryListRows } from '../../../../../../../shared-test-assertions';
import application from '../../../../../../../fixtures/application';
import FIELD_IDS from '../../../../../../../constants/field-ids/insurance/export-contract';
import { EXPORT_CONTRACT_FIELDS as FIELDS } from '../../../../../../../content-strings/fields/insurance/export-contract';

const {
ROOT: INSURANCE_ROOT,
CHECK_YOUR_ANSWERS: { EXPORT_CONTRACT },
} = INSURANCE_ROUTES;

const {
HOW_WAS_THE_CONTRACT_AWARDED: { OTHER_AWARD_METHOD },
HOW_WAS_THE_CONTRACT_AWARDED: { OTHER_AWARD_METHOD, AWARD_METHOD },
} = FIELD_IDS;

const { OTHER } = FIELDS.HOW_WAS_THE_CONTRACT_AWARDED[AWARD_METHOD].OPTIONS;

const { taskList } = partials.insurancePartials;

const task = taskList.submitApplication.tasks.checkAnswers;

const baseUrl = Cypress.config('baseUrl');

context(
'Insurance - Check your answers - Export contract - Summary list - Contract awarded other method - As an exporter, I want to be able to review my input for the export contract again, So that I can do a final review of the information I previously input before submitting my application',
`Insurance - Check your answers - Export contract - Summary list - Contract awarded ${OTHER.TEXT} - As an exporter, I want to be able to review my input for the export contract again, So that I can do a final review of the information I previously input before submitting my application`,
() => {
let referenceNumber;
let url;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ context(
beforeEach(() => {
cy.navigateToUrl(checkYourAnswersUrl);

// change to DIRECT_AWARD
// select DIRECT_AWARD
summaryList.field(FIELD_ID).changeLink().click();
cy.completeAndSubmitHowWasTheContractAwardedForm({ directAward: true });

// change back to OTHER
// select OTHER
summaryList.field(FIELD_ID).changeLink().click();
const selector = radios(OTHER.ID).option;
selector.label().click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import mapSubmittedData from '.';
import FIELD_IDS from '../../../../../constants/field-ids/insurance/export-contract';
import getCountryByIsoCode from '../../../../../helpers/get-country-by-iso-code';
import { EXPORT_CONTRACT_AWARD_METHOD } from '../../../../../constants';
import { mockCountries, mockExportContract, mockOtherAwardMethod } from '../../../../../test-mocks';
import { mockCountries, mockExportContract } from '../../../../../test-mocks';
import { RequestBody } from '../../../../../../types';

const {
Expand Down Expand Up @@ -126,7 +126,8 @@ describe('controllers/insurance/export-contract/map-submitted-data/export-contra
it(`should return the form body with ${OTHER_AWARD_METHOD} populated`, () => {
const mockBody = {
...mockFormBody,
...mockOtherAwardMethod,
[AWARD_METHOD]: OTHER_DB_ID,
[OTHER_AWARD_METHOD]: mockExportContract.otherAwardMethod,
};

const result = mapSubmittedData(mockBody, mockCountries);
Expand Down
2 changes: 0 additions & 2 deletions src/ui/server/test-mocks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import mockApplication, {
mockExportContractAgentService,
mockExportContractAgentServiceCharge,
mockNominatedLossPayee,
mockOtherAwardMethod,
referenceNumber,
} from './mock-application';
import mockApplications from './mock-applications';
Expand Down Expand Up @@ -169,7 +168,6 @@ export {
mockLossPayeeFinancialDetailsInternational,
mockLossPayeeFinancialDetailsUk,
mockNominatedLossPayee,
mockOtherAwardMethod,
mockUrlOrigin,
mockSession,
mockSicCodes,
Expand Down
6 changes: 1 addition & 5 deletions src/ui/server/test-mocks/mock-application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export const mockExportContract = {
...EXPORT_CONTRACT_AWARD_METHOD.COMPETITIVE_BIDDING,
id: 'clldfm6pt000noqa6fs6cj5xo',
},
otherAwardMethod: 'Mock other award method',
goodsOrServicesDescription: 'Mock description',
finalDestinationKnown: false,
finalDestinationCountryCode: mockCountries[0].isoCode,
Expand All @@ -102,11 +103,6 @@ export const mockExportContract = {
agent: mockExportContractAgent,
};

export const mockOtherAwardMethod = {
awardMethod: EXPORT_CONTRACT_AWARD_METHOD.OTHER.DB_ID,
otherAwardMethod: 'test',
};

export const mockOwner = {
id: mockAccount.id,
};
Expand Down

0 comments on commit e32de81

Please sign in to comment.