Skip to content

Commit

Permalink
Test that EYB activity cards are displayed on the overview page
Browse files Browse the repository at this point in the history
  • Loading branch information
swenban committed Dec 17, 2024
1 parent bb1c212 commit 621d147
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/functional/cypress/fakers/company-activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -151,13 +173,23 @@ const companyActivityInvestmentListFaker = (
})
}

const companyActivityEYBListFaker = (length = 1, overrides, EYBOverrides) => {
return listFakerAdditionalOverrides({
fakerFunction: companyActivityEYBFaker,
length,
overrides,
additionalOverrides: EYBOverrides,
})
}

export {
companyActivityInteractionFaker,
companyActivityInvestmentFaker,
companyActivityInteractionListFaker,
companyActivityInvestmentListFaker,
companyActivityOrderListFaker,
companyActivityGreatListFaker,
companyActivityEYBListFaker,
}

export default companyActivityInteractionListFaker
52 changes: 52 additions & 0 deletions test/functional/cypress/specs/companies/overview-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
import { getCollectionList } from '../../support/collection-list-assertions'
import { collectionListRequest } from '../../support/actions'
import companyActivityListFaker, {
companyActivityEYBListFaker,
companyActivityGreatListFaker,
companyActivityInvestmentListFaker,
companyActivityOrderListFaker,
Expand Down Expand Up @@ -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"]')
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 621d147

Please sign in to comment.