Skip to content

Commit

Permalink
Test that activity for investment projects with EYB leads displays co…
Browse files Browse the repository at this point in the history
…rrectly on overview page
  • Loading branch information
swenban committed Dec 16, 2024
1 parent 295b1dd commit 63ab3e7
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 9 deletions.
2 changes: 1 addition & 1 deletion test/functional/cypress/fakers/company-activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const companyActivityInvestmentFaker = (
name: faker.word.words(),
client_contacts: [userFaker({ job_title: faker.person.jobTitle() })],
id: faker.string.uuid(),
number_new_jobs: faker.number.int({ min: 0, max: 50 }),
number_new_jobs: faker.number.int({ min: 1, max: 50 }),
created_by: userFaker(),
foreign_equity_investment: faker.number.int({ min: 50, max: 1000 }),
gross_value_added: faker.number.int({ min: 100, max: 2000 }),
Expand Down
63 changes: 55 additions & 8 deletions test/functional/cypress/specs/companies/overview-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,12 +391,21 @@ describe('Company overview page', () => {
// TODO - Unskip relevant parts of this test when we have the associated DAGs in place
context('when viewing all activity cards types', () => {
const interactionsList = companyActivityListFaker(1)
const investmentsList = companyActivityInvestmentListFaker(1)
const investmentsListNullJobs = companyActivityInvestmentListFaker(
const investmentsListWithJobsNoEYBLead =
companyActivityInvestmentListFaker(1)
const investmentsListNullJobsNoEYBLead = companyActivityInvestmentListFaker(
1,
{},
{ number_new_jobs: null }
)
const investmentsListWithJobsHasEYBLead =
companyActivityInvestmentListFaker(1, {}, { eyb_leads: [{ id: '1' }] })
const investmentsListNullJobsHasEYBLead =
companyActivityInvestmentListFaker(
1,
{},
{ number_new_jobs: null, eyb_leads: [{ id: '1' }] }
)
const orderList = companyActivityOrderListFaker(1)
const orderListNoPrimaryMarket = companyActivityOrderListFaker(
1,
Expand Down Expand Up @@ -511,34 +520,72 @@ describe('Company overview page', () => {
activity.interaction.subject
)
})
it('should display Data Hub investment activity', () => {
it('should display Data Hub investment activity with jobs and no link to EYB leads', () => {
collectionListRequest(
'v4/search/company-activity',
investmentsList,
investmentsListWithJobsNoEYBLead,
urls.companies.overview.index(fixtures.company.venusLtd.id)
)
const activity = investmentsList[0]
const activity = investmentsListWithJobsNoEYBLead[0]
cy.get('[data-test="investment-kind-label"]').contains(
'New Investment Project'
)
cy.get('[data-test="activity-summary"]').contains(
`${activity.investment.investment_type.name} investment for ${activity.investment.number_new_jobs} new jobs added by ${activity.investment.created_by.name}`
)
cy.get('[data-test="activity-summary"]').should(
'not.include.text',
'from EYB lead'
)
})

it('should display Data Hub investment activity with empty number of new jobs', () => {
it('should display Data Hub investment activity with empty number of new jobs and no link to an EYB lead', () => {
collectionListRequest(
'v4/search/company-activity',
investmentsListNullJobs,
investmentsListNullJobsNoEYBLead,
urls.companies.overview.index(fixtures.company.venusLtd.id)
)
const activity = investmentsListNullJobs[0]
const activity = investmentsListNullJobsNoEYBLead[0]
cy.get('[data-test="investment-kind-label"]').contains(
'New Investment Project'
)
cy.get('[data-test="activity-summary"]').contains(
`${activity.investment.investment_type.name} investment added by ${activity.investment.created_by.name}`
)
cy.get('[data-test="activity-summary"]').should(
'not.include.text',
'from EYB lead'
)
})

it('should display Data Hub investment activity with jobs and link to an EYB lead', () => {
collectionListRequest(
'v4/search/company-activity',
investmentsListWithJobsHasEYBLead,
urls.companies.overview.index(fixtures.company.venusLtd.id)
)
const activity = investmentsListWithJobsHasEYBLead[0]
cy.get('[data-test="investment-kind-label"]').contains(
'New Investment Project'
)
cy.get('[data-test="activity-summary"]').contains(
`${activity.investment.investment_type.name} investment for ${activity.investment.number_new_jobs} new jobs added by ${activity.investment.created_by.name} from EYB lead`
)
})

it('should display Data Hub investment activity with empty number of new jobs and link to an EYB lead', () => {
collectionListRequest(
'v4/search/company-activity',
investmentsListNullJobsHasEYBLead,
urls.companies.overview.index(fixtures.company.venusLtd.id)
)
const activity = investmentsListNullJobsHasEYBLead[0]
cy.get('[data-test="investment-kind-label"]').contains(
'New Investment Project'
)
cy.get('[data-test="activity-summary"]').contains(
`${activity.investment.investment_type.name} investment added by ${activity.investment.created_by.name} from EYB lead`
)
})

it('should display Data Hub order activity', () => {
Expand Down

0 comments on commit 63ab3e7

Please sign in to comment.