-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test EYB activity card displays the correct data
- Loading branch information
Showing
3 changed files
with
89 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
test/component/cypress/specs/Companies/CompanyOverview/ActivityCard/EYBActivityCard.cy.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import React from 'react' | ||
|
||
import urls from '../../../../../../../src/lib/urls' | ||
|
||
import { transformEYBLeadToListItem } from '../../../../../../../src/client/modules/Companies/CompanyOverview/TableCards/ActivityCards/transformers' | ||
import { ItemTemplate } from '../../../../../../../src/client/modules/Companies/CompanyOverview/TableCards/ActivityCards/ActivityCard' | ||
import { CollectionList } from '../../../../../../../src/client/components' | ||
import { | ||
assertActivitySubject, | ||
assertEYBLabel, | ||
} from '../../../../support/activity-assertions' | ||
|
||
const EYB_LEAD_ID = 'e686c9d9-d7ba-444d-a85b-a64c477fc1ba' | ||
const PROJECT_URL = urls.investments.eybLeads.details(EYB_LEAD_ID) | ||
const COMPANY_NAME = 'Booth Sykes' | ||
|
||
const buildAndMountActivity = (value = null) => { | ||
const activity = { | ||
eyb_lead: { | ||
is_high_value: value, | ||
created_on: '2024-12-02T09:59:03.911296+00:00', | ||
company_name: COMPANY_NAME, | ||
triage_created: '2024-12-01T09:59:03+00:00', | ||
id: EYB_LEAD_ID, | ||
}, | ||
} | ||
|
||
cy.mountWithProvider( | ||
<CollectionList | ||
items={[transformEYBLeadToListItem(activity)]} | ||
collectionItemTemplate={ItemTemplate} | ||
/> | ||
) | ||
} | ||
|
||
describe('EYB lead activity card', () => { | ||
context('When the card is rendered with a lead of unknown value', () => { | ||
beforeEach(() => { | ||
buildAndMountActivity() | ||
cy.get('[data-test="activity-card-wrapper"]').should('exist') | ||
}) | ||
|
||
it('should render the labels and metadata', () => { | ||
assertEYBLabel() | ||
assertActivitySubject(COMPANY_NAME, PROJECT_URL, 'activity-card-wrapper') | ||
cy.get('[data-test="activity-summary"]').should( | ||
'have.text', | ||
`An unknown-value EYB lead associated with this company has been added to Data Hub` | ||
) | ||
}) | ||
}) | ||
|
||
context('When the card is rendered with a lead of high value', () => { | ||
beforeEach(() => { | ||
buildAndMountActivity(true) | ||
cy.get('[data-test="activity-card-wrapper"]').should('exist') | ||
}) | ||
|
||
it('should render the labels and metadata', () => { | ||
assertEYBLabel() | ||
assertActivitySubject(COMPANY_NAME, PROJECT_URL, 'activity-card-wrapper') | ||
cy.get('[data-test="activity-summary"]').should( | ||
'have.text', | ||
`A high-value EYB lead associated with this company has been added to Data Hub` | ||
) | ||
}) | ||
}) | ||
|
||
context('When the card is rendered with a lead of low value', () => { | ||
beforeEach(() => { | ||
buildAndMountActivity(false) | ||
cy.get('[data-test="activity-card-wrapper"]').should('exist') | ||
}) | ||
|
||
it('should render the labels and metadata', () => { | ||
assertEYBLabel() | ||
assertActivitySubject(COMPANY_NAME, PROJECT_URL, 'activity-card-wrapper') | ||
cy.get('[data-test="activity-summary"]').should( | ||
'have.text', | ||
`A low-value EYB lead associated with this company has been added to Data Hub` | ||
) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters