Skip to content

Commit

Permalink
Merge pull request #7422 from uktrade/feature/TET-812-add-stova-servi…
Browse files Browse the repository at this point in the history
…ce-tag

Feature/tet 812 add stova service tag
  • Loading branch information
DeanElliott96 authored Dec 20, 2024
2 parents 9865f33 + 56a1bca commit 9450f2c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ export const getServiceText = (service) => {
: service.includes('Investment Enquiry') ||
service.includes('Investment enquiry')
? 'Enquiry'
: INTERACTION_SERVICES[serviceType]
: service.includes('Stova Event Service')
? 'Stova Event'
: INTERACTION_SERVICES[serviceType]
return serviceText
}

Expand Down
7 changes: 4 additions & 3 deletions src/client/modules/Events/transformers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import urls from '../../../lib/urls'

import { getDifferenceInDays, formatStartAndEndDate } from '../../utils/date'

import { TAG_COLOURS } from '../../components/Tag'
import {
formatDate,
DATE_FORMAT_FULL,
Expand Down Expand Up @@ -32,23 +33,23 @@ const transformEventToListItem = ({
if (event_type) {
tags.push({
text: event_type.name,
colour: 'grey',
colour: TAG_COLOURS.GREY,
dataTest: 'event-kind-label',
})
}

if (service) {
tags.push({
text: getServiceText(service.name),
colour: 'default',
colour: TAG_COLOURS.GOV_BLUE,
dataTest: 'event-theme-label',
})
}

if (service && service2) {
tags.push({
text: getServiceOtherText(service2),
colour: 'blue',
colour: TAG_COLOURS.BLUE,
dataTest: 'event-service-label',
})
}
Expand Down
24 changes: 22 additions & 2 deletions test/functional/cypress/specs/events/collection-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,28 @@ describe('Event Collection List Page', () => {
},
})

const eventsList = [event1, event2]
const stovaEvent = eventFaker({
id: 'd848746d-e7dd-4bf2-98ce-05f9833be662',
event_type: {
name: 'Exhibition',
id: '2fade471-e868-4ea9-b125-945eb90ae5d4',
},
lead_team: null,
name: 'Empty one-day exhibition',
organiser: null,
service: {
name: 'Stova Event Service',
id: '8053f984-fac6-4d35-b3df-4ac0eeb3b542',
},
})

const eventsList = [event1, event2, stovaEvent]
context('when there is not an error', () => {
beforeEach(() => {
collectionListRequest('v3/search/event', eventsList, events.index())
getCollectionList()
cy.get('@collectionItems').eq(1).as('secondListItem')
cy.get('@collectionItems').eq(2).as('thirdListItem')
})

assertCollectionBreadcrumbs('Events')
Expand All @@ -68,7 +84,7 @@ describe('Event Collection List Page', () => {
})

it('should display the events result count header', () => {
cy.get('h2').contains('2 events')
cy.get('h2').contains('3 events')
})

it('should have a link to add event', () => {
Expand Down Expand Up @@ -122,5 +138,9 @@ describe('Event Collection List Page', () => {
assertMetadataItemNotPresent('@secondListItem', 'Lead team')
assertMetadataItemNotPresent('@secondListItem', 'Organiser')
})

it('should display the stova event service type', () => {
assertMetadataItem('@thirdListItem', 'Stova Event')
})
})
})

0 comments on commit 9450f2c

Please sign in to comment.