Skip to content

Commit

Permalink
Removing modified as default sort for EYB leads (#7554)
Browse files Browse the repository at this point in the history
  • Loading branch information
stuart-mindt authored Feb 14, 2025
1 parent fc72e8c commit 44e36a9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const EYBLeadCollection = ({
entityName="eybLead"
defaultQueryParams={{
page: 1,
sortby: '-triage_modified',
sortby: '-triage_created',
}}
selectedFilters={selectedFilters}
>
Expand Down
8 changes: 4 additions & 4 deletions src/client/modules/Investments/EYBLeads/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ export const VALUE_OPTIONS = [
]

export const SORT_OPTIONS = [
{
name: 'Recently modified',
value: '-triage_modified',
},
{
name: 'Recently created',
value: '-triage_created',
},
{
name: 'Recently modified',
value: '-triage_modified',
},
{
name: 'Company A-Z',
value: 'company__name',
Expand Down
2 changes: 1 addition & 1 deletion src/client/modules/Investments/EYBLeads/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const getEYBLeads = ({
limit,
offset: limit * (parseInt(page, 10) - 1) || 0,
...(company ? { company } : null),
sortby: sortby ? sortby : '-triage_modified',
sortby: sortby ? sortby : '-triage_created',
})
overseas_region.forEach((overseasRegionId) =>
params.append('overseas_region', overseasRegionId)
Expand Down
30 changes: 15 additions & 15 deletions test/functional/cypress/specs/investments/eyb-leads-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ const EYB_LEAD_LIST = Array(
)

const PAYLOADS = {
minimum: { limit: '10', offset: '0', sortby: '-triage_modified' },
minimum: { limit: '10', offset: '0', sortby: '-triage_created' },
companyFilter: { company: COMPANY_NAME },
sectorFilter: { sector: SECTOR_ID },
highValueFilter: { value: HIGH_VALUE },
lowValueFilter: { value: LOW_VALUE },
unknownValueFilter: { value: UNKNOWN_VALUE },
countryFilter: { country: COUNTRY_ID_1 },
sortByModified: { sortby: '-triage_modified' },
sortByCreated: { sortby: '-triage_created' },
sortByModified: { sortby: '-triage_modified' },
sortByCompanyAZ: { sortby: 'company__name' },
}

Expand Down Expand Up @@ -596,29 +596,29 @@ describe('EYB leads collection page', () => {
cy.get('[data-test="sortby"] select option').then((options) => {
const actual = [...options].map((o) => o.value)
expect(actual).to.deep.eq([
'-triage_modified',
'-triage_created',
'-triage_modified',
'company__name',
])
})
})

it('should sort by most recently modified by default', () => {
assertQueryParams('sortby', '-triage_modified')
it('should sort by most recently created by default', () => {
assertQueryParams('sortby', '-triage_created')
cy.wait('@apiRequest')
.its('request.query')
.should('include', PAYLOADS.sortByModified)
.should('include', PAYLOADS.sortByCreated)
})

it('should sort by recently created', () => {
it('should sort by recently modified', () => {
cy.intercept('GET', `${EYB_RETRIEVE_API_ROUTE}?*`, (req) => {
if (req.query.sortby === '-triage_created') req.alias = 'sortedRequest'
if (req.query.sortby === '-triage_modified') req.alias = 'sortedRequest'
})
cy.get('[data-test="sortby"] select').select('-triage_created')
assertQueryParams('sortby', '-triage_created')
cy.get('[data-test="sortby"] select').select('-triage_modified')
assertQueryParams('sortby', '-triage_modified')
cy.wait('@sortedRequest')
.its('request.query')
.should('include', PAYLOADS.sortByCreated)
.should('include', PAYLOADS.sortByModified)
})

it('should sort by company name A-Z', () => {
Expand All @@ -635,13 +635,13 @@ describe('EYB leads collection page', () => {
it('should sort by most recently created when another sort option is selected', () => {
cy.get('[data-test="sortby"] select').select('company__name')
cy.intercept('GET', `${EYB_RETRIEVE_API_ROUTE}?*`, (req) => {
if (req.query.sortby === '-triage_modified') req.alias = 'sortedRequest'
if (req.query.sortby === '-triage_created') req.alias = 'sortedRequest'
})
cy.get('[data-test="sortby"] select').select('-triage_modified')
assertQueryParams('sortby', '-triage_modified')
cy.get('[data-test="sortby"] select').select('-triage_created')
assertQueryParams('sortby', '-triage_created')
cy.wait('@sortedRequest')
.its('request.query')
.should('include', PAYLOADS.sortByModified)
.should('include', PAYLOADS.sortByCreated)
})
})
})

0 comments on commit 44e36a9

Please sign in to comment.