Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(EMS-3631): declarations - replace api/keystone rendering with content-strings #2813

Merged
merged 4 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 0 additions & 134 deletions e2e-tests/commands/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,52 +154,6 @@ const queryStrings = {
}
}
`,
declarations: {
getLatestConfidentiality: () => gql`
query declarationConfidentialities {
declarationConfidentialities(orderBy: { version: desc }, take: 1) {
id
version
content {
document
}
}
}
`,
getLatestAntiBribery: () => gql`
query declarationAntiBriberies {
declarationAntiBriberies(orderBy: { version: desc }, take: 1) {
id
version
content {
document
}
}
}
`,
getLatestConfirmationAndAcknowledgements: () => gql`
query declarationConfirmationAndAcknowledgements {
declarationConfirmationAndAcknowledgements(orderBy: { version: desc }, take: 1) {
id
version
content {
document
}
}
}
`,
getLatestHowDataWillBeUsed: () => gql`
query declarationHowDataWillBeUseds {
declarationHowDataWillBeUseds(orderBy: { version: desc }, take: 1) {
id
version
content {
document
}
}
}
`,
},
};

/**
Expand Down Expand Up @@ -582,93 +536,6 @@ const getACountry = async () => {
}
};

const declarations = {
/**
* getLatestConfidentiality
* Get the latest Confidentiality declaration content
* @returns {Object} Confidentiality declaration
*/
getLatestConfidentiality: async () => {
try {
const responseBody = await apollo
.query({
query: queryStrings.declarations.getLatestConfidentiality(),
context: APOLLO_CONTEXT,
})
.then((response) => response.data.declarationConfidentialities[0]);

return responseBody;
} catch (err) {
console.error(err);

throw new Error('Getting latest declaration - confidentiality ', { err });
}
},
/**
* getLatestAntiBribery
* Get the latest Anti-bribery declaration content
* @returns {Object} Anti-bribery declaration
*/
getLatestAntiBribery: async () => {
try {
const responseBody = await apollo
.query({
query: queryStrings.declarations.getLatestAntiBribery(),
context: APOLLO_CONTEXT,
})
.then((response) => response.data.declarationAntiBriberies[0]);

return responseBody;
} catch (err) {
console.error(err);

throw new Error('Getting latest declaration - anti-bribery ', { err });
}
},
/**
* getLatestConfirmationAndAcknowledgements
* Get the latest Confirmation and acknowledgements declaration content
* @returns {Object} Confirmation and acknowledgements declaration
*/
getLatestConfirmationAndAcknowledgements: async () => {
try {
const responseBody = await apollo
.query({
query: queryStrings.declarations.getLatestConfirmationAndAcknowledgements(),
context: APOLLO_CONTEXT,
})
.then((response) => response.data.declarationConfirmationAndAcknowledgements[0]);

return responseBody;
} catch (err) {
console.error(err);

throw new Error('Getting latest declaration - confirmation and acknowledgements ', { err });
}
},
/**
* getLatestHowDataWillBeUsed
* Get the latest How data will be used declaration content
* @returns {Object} Confirmation and acknowledgements declaration
*/
getLatestHowDataWillBeUsed: async () => {
try {
const responseBody = await apollo
.query({
query: queryStrings.declarations.getLatestHowDataWillBeUsed(),
context: APOLLO_CONTEXT,
})
.then((response) => response.data.declarationHowDataWillBeUseds[0]);

return responseBody;
} catch (err) {
console.error(err);

throw new Error('Getting latest declaration - how data will be used ', { err });
}
},
};

const api = {
createAnAccount,
createBuyer,
Expand All @@ -685,7 +552,6 @@ const api = {
deleteApplicationByReferenceNumber,
deleteApplications,
getACountry,
declarations,
};

export default api;
25 changes: 0 additions & 25 deletions e2e-tests/commands/flatten-keystone-document.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,58 @@ export const ANTI_BRIBERY = {
],
},
},
INTRO: "By submitting this application (also known as a 'proposal') you agree that:",
LIST: [
{
text: 'neither you nor any of your current Senior Officers appear on a debarment list published by the World Bank Group, the African Development Bank, the Asian Development Bank, the European Bank for Reconstruction and Development or the Inter-American Development Bank (or any successor organisations of the foregoing), of contractors or individuals who are ineligible to tender for, or participate in, any project they fund;',
},
{
text: 'you have no reason to believe, after having made reasonable enquiries, that any Involved Group Company, Consortium Party or Agent, or any of their current Senior Officers, appear on any such list;',
},
{
text: 'during the last 5 years neither you nor any of your current Senior Officers or any Group Company have:',
children: [
{
text: 'been found guilty by any court or competent authority of a Relevant Offence or any offence relating to bribery or corruption under the law of any jurisdiction outside the UK;',
},
{
text: 'been subject to any administrative sanction (for example, a deferred prosecution agreement or civil forfeiture order) or other similar administrative measure anywhere in the world for contravening any laws which prohibit bribery, including bribery of foreign public officials; or',
},
{
text: 'admitted to having engaged in any offence or activity as referred to in paragraph (3)(a) above or has admitted to engaging in any other activity which is prohibited under applicable laws relating to bribery or corrupt activity;',
},
],
},
{
text: 'neither you nor any of your current Senior Officers or any Group Company are currently under charge in any court or before any competent authority, or to the best of your knowledge, subject to a formal investigation by public prosecutors on the grounds that you or they have committed an offence of the type listed in paragraph 3(a) above;',
},
{
text: 'neither you nor any Group Company has: engaged in, any Potential Corrupt Activity or Corrupt Activity in relation to the export contract(s) or any related agreement (which includes any unilateral undertaking as well as any consent or authorisation needed to obtain or perform the export contract(s) but not any subcontract);',
},
{
text: 'neither you nor any Involved Group Company has any knowledge of any person engaging in any Potential Corrupt Activity or Corrupt Activity in relation to the export contract(s) or any related agreement;',
},
{
text: 'you have no reason to believe and you do not believe, after having made reasonable enquiries, that:',
children: [
{
text: 'any Consortium Party or Agent, any of their current Senior Officers has at any time during the last five years engaged in or been subject to any of the events referred to in paragraph (3) above;',
},
{
text: 'any Consortium Party or Agent or any of their current Senior Officers has at any time during the last five years been subject to any of the events referred to in paragraph (4) above; or',
},
{
text: 'any Consortium Party or Agent has engaged in any Potential Corrupt Activity or Corrupt Activity in relation to the export contract(s) or any related agreement;',
},
],
},
{
text: 'you have made reasonable enquiries regarding (i) any Consortium Party or Agent and its conduct in relation to the export contract and any related agreement; and (ii) whether any Group Companies, at the date of this Proposal, have had, or are intended to have any material part in the negotiation or supply of the export contract;',
},
{
text: 'the export contract(s) referred to in this Proposal , and all arrangements connected with its/their financing or procurement, have not been, and will not be, used for the purposes of money laundering (as defined in Part 7 of the Proceeds of Crime Act 2002) or in any other manner that would constitute a Relevant Offence.',
},
],
},
],
};
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,26 @@ export const CONFIRMATION_AND_ACKNOWLEDGEMENTS = {
TEXT: `${HAVE_READ_AND_AGREED} the confirmation and acknowledgements`,
VALUE: true,
},
INTRO: "By submitting this application (also known as a 'proposal') you agree that:",
LIST: [
{
text: 'you confirm that the information contained in this Proposal and any related discussions or correspondence constitutes a fair presentation of the risk to include all material facts and circumstances; and',
},
{
text: 'you acknowledge that:',
children: [
{
text: 'you should contact us or your broker (if applicable) if you are in any doubt as to what constitutes a material fact;',
},
{
text: 'we will rely on the information, statements and declarations in this Proposal when deciding whether, and on what terms, to issue any policy; and',
},
{
text: 'you must continue to disclose material facts to us and any changes to material facts after the date of signature of this Proposal until the date cover commences under any policy unless this would, or might reasonably be considered to, constitute the offence of “tipping off” under s.333A of the Proceeds of Crime Act 2002.',
},
],
},
],
},
],
};
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import { headingCaption, singleInputField } from '../../../../../../pages/shared';
import { headingCaption, singleInputField, declarationPage } from '../../../../../../pages/shared';
import { antiBriberyPage } from '../../../../../../pages/insurance/declarations';
import partials from '../../../../../../partials';
import { PAGES, ERROR_MESSAGES } from '../../../../../../content-strings';
import { FIELD_IDS } from '../../../../../../constants';
import { INSURANCE_ROUTES } from '../../../../../../constants/routes/insurance';

import api from '../../../../../../commands/api';
import flattenKeystoneDocument from '../../../../../../commands/flatten-keystone-document';

const { taskList } = partials.insurancePartials;

const CONTENT_STRINGS = PAGES.INSURANCE.DECLARATIONS.ANTI_BRIBERY.VERSIONS[0];
Expand Down Expand Up @@ -76,43 +73,41 @@ context(
cy.checkText(headingCaption(), CONTENT_STRINGS.HEADING_CAPTION);
});

describe('latest confidentiality content', () => {
let content;

const { intro, level1, firstLevel2, secondLevel2 } = antiBriberyPage.listItems;
describe('latest anti-bribery content', () => {
const listContent = CONTENT_STRINGS.LIST;

before(() => {
api.declarations.getLatestAntiBribery().then((data) => {
content = flattenKeystoneDocument(data.content.document);
});
});
const { intro, level1, level2 } = declarationPage.listItems;

it('renders an intro paragraph', () => {
cy.checkText(intro(), content[0].text);
cy.checkText(intro(), CONTENT_STRINGS.INTRO);
});

it('renders level 1 list items', () => {
cy.checkText(level1.item(1), content[1].text);
cy.checkText(level1.item(2), content[2].text);
cy.checkText(level1.item(3), content[3].text);

cy.checkText(level1.item(4), content[7].text);
cy.checkText(level1.item(5), content[8].text);
cy.checkText(level1.item(6), content[9].text);
cy.checkText(level1.item(7), content[10].text);

cy.checkText(level1.item(8), content[14].text);
cy.checkText(level1.item(9), content[15].text);
const level1Content = listContent;

cy.checkText(level1.item(1), level1Content[0].text);
cy.checkText(level1.item(2), level1Content[1].text);
cy.checkText(level1.item(3), level1Content[2].text);
cy.checkText(level1.item(4), level1Content[3].text);
cy.checkText(level1.item(5), level1Content[4].text);
cy.checkText(level1.item(6), level1Content[5].text);
cy.checkText(level1.item(7), level1Content[6].text);
cy.checkText(level1.item(8), level1Content[7].text);
cy.checkText(level1.item(9), level1Content[8].text);
});

it('renders level 2 list items', () => {
cy.checkText(firstLevel2.item(1), content[4].text);
cy.checkText(firstLevel2.item(2), content[5].text);
cy.checkText(firstLevel2.item(3), content[6].text);
const level2Content0 = listContent[2].children;

cy.checkText(level2.itemLevel(1, 0), level2Content0[0].text);
cy.checkText(level2.itemLevel(2, 0), level2Content0[1].text);
cy.checkText(level2.itemLevel(3, 0), level2Content0[2].text);

const level2Content1 = listContent[6].children;

cy.checkText(secondLevel2.item(1), content[11].text);
cy.checkText(secondLevel2.item(2), content[12].text);
cy.checkText(secondLevel2.item(3), content[13].text);
cy.checkText(level2.itemLevel(1, 1), level2Content1[0].text);
cy.checkText(level2.itemLevel(2, 1), level2Content1[1].text);
cy.checkText(level2.itemLevel(3, 1), level2Content1[2].text);
});
Zainzzkk marked this conversation as resolved.
Show resolved Hide resolved
});

Expand Down
Loading
Loading