diff --git a/test/functional/cypress/fakers/company-activity.js b/test/functional/cypress/fakers/company-activity.js index 06d84213e2..2a11318e08 100644 --- a/test/functional/cypress/fakers/company-activity.js +++ b/test/functional/cypress/fakers/company-activity.js @@ -105,6 +105,28 @@ const companyActivityGreatFaker = (overrides = {}, orderOverrides = {}) => ({ ...overrides, }) +const companyActivityEYBFaker = (overrides = {}, eybOverrides = {}) => { + return { + ...companyActivityFaker(), + activity_source: 'eyb_lead', + id: faker.string.uuid(), + company: { + name: faker.company.name, + id: '1c5f7b5f-acd0-4a17-ac9d-8600bb5ded86', + }, + eyb_lead: { + is_high_value: faker.datatype.boolean(), + created_on: '2024-12-02T09:59:03.911296+00:00', + company_name: faker.company.name, + triage_created: '2024-12-01T09:59:03+00:00', + id: faker.string.uuid(), + duns_number: faker.number.int({ min: 1000000, max: 9999999 }).toString(), + ...eybOverrides, + }, + ...overrides, + } +} + const companyActivityInteractionListFaker = (length = 1, overrides) => listFaker({ fakerFunction: companyActivityInteractionFaker, @@ -151,6 +173,15 @@ const companyActivityInvestmentListFaker = ( }) } +const companyActivityEYBListFaker = (length = 1, overrides, EYBOverrides) => { + return listFakerAdditionalOverrides({ + fakerFunction: companyActivityEYBFaker, + length, + overrides, + additionalOverrides: EYBOverrides, + }) +} + export { companyActivityInteractionFaker, companyActivityInvestmentFaker, @@ -158,6 +189,7 @@ export { companyActivityInvestmentListFaker, companyActivityOrderListFaker, companyActivityGreatListFaker, + companyActivityEYBListFaker, } export default companyActivityInteractionListFaker diff --git a/test/functional/cypress/specs/companies/overview-spec.js b/test/functional/cypress/specs/companies/overview-spec.js index 9daa6e5c49..5b6f856df2 100644 --- a/test/functional/cypress/specs/companies/overview-spec.js +++ b/test/functional/cypress/specs/companies/overview-spec.js @@ -6,6 +6,7 @@ import { import { getCollectionList } from '../../support/collection-list-assertions' import { collectionListRequest } from '../../support/actions' import companyActivityListFaker, { + companyActivityEYBListFaker, companyActivityGreatListFaker, companyActivityInvestmentListFaker, companyActivityOrderListFaker, @@ -420,6 +421,21 @@ describe('Company overview page', () => { urls.companies.overview.index(fixtures.company.venusLtd.id) ) }) + const EYBListHighValue = companyActivityEYBListFaker( + 1, + {}, + { is_high_value: true } + ) + const EYBListLowValue = companyActivityEYBListFaker( + 1, + {}, + { is_high_value: false } + ) + const EYBListUnknownValue = companyActivityEYBListFaker( + 1, + {}, + { is_high_value: null } + ) it.skip('should display aventri event activity', () => { cy.get('[data-test="aventri-event-summary"]') @@ -644,6 +660,42 @@ describe('Company overview page', () => { `Enquirer ${activity.great_export_enquiry.contact.first_name} ${activity.great_export_enquiry.contact.last_name}` ) }) + + it('should display Data Hub EYB lead activity with high value', () => { + collectionListRequest( + 'v4/search/company-activity', + EYBListHighValue, + urls.companies.overview.index(fixtures.company.venusLtd.id) + ) + cy.get('[data-test="eyb-label"]').contains('EYB') + cy.get('[data-test="activity-summary"]').contains( + 'A high-value EYB lead associated with this company has been added to Data Hub' + ) + }) + + it('should display Data Hub EYB lead activity with low value', () => { + collectionListRequest( + 'v4/search/company-activity', + EYBListLowValue, + urls.companies.overview.index(fixtures.company.venusLtd.id) + ) + cy.get('[data-test="eyb-label"]').contains('EYB') + cy.get('[data-test="activity-summary"]').contains( + 'A low-value EYB lead associated with this company has been added to Data Hub' + ) + }) + + it('should display Data Hub EYB lead activity with unknown value', () => { + collectionListRequest( + 'v4/search/company-activity', + EYBListUnknownValue, + urls.companies.overview.index(fixtures.company.venusLtd.id) + ) + cy.get('[data-test="eyb-label"]').contains('EYB') + cy.get('[data-test="activity-summary"]').contains( + 'An unknown-value EYB lead associated with this company has been added to Data Hub' + ) + }) }) context(