Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
chopkinsmade committed Dec 11, 2024
1 parent c2b771a commit 43b750b
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 33 deletions.
13 changes: 0 additions & 13 deletions src/apps/contacts/services/__test__/form.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ describe('contact form service', () => {
primary: true,
full_telephone_number: '+1 652423467167',
email: '[email protected]',
accepts_dit_email_marketing: true,
address_same_as_company: false,
notes: 'Some notes',
archived_by: null,
Expand Down Expand Up @@ -60,7 +59,6 @@ describe('contact form service', () => {
primary: 'yes',
full_telephone_number: '+1 652423467167',
email: '[email protected]',
accepts_dit_email_marketing: true,
address_same_as_company: 'no',
address_1: '99 N Shore Road',
address_2: 'Suite 20',
Expand Down Expand Up @@ -107,7 +105,6 @@ describe('contact form service', () => {
address_postcode: null,
address_country: null,
notes: 'Some notes',
accepts_dit_email_marketing: true,
}

const actual = contactFormService.getContactAsFormData(contact)
Expand All @@ -118,15 +115,5 @@ describe('contact form service', () => {
it('should handle a null contact', () => {
expect(contactFormService.getContactAsFormData(null)).to.be.null
})

context('when the contact accepts DBT email marketing', () => {
it('should set the marketing preferences to accepts_dit_email_marketing', () => {
const contact = assign({}, contactData, {
accepts_dit_email_marketing: true,
})
const actual = contactFormService.getContactAsFormData(contact)
expect(actual.accepts_dit_email_marketing).to.be.true
})
})
})
})
6 changes: 0 additions & 6 deletions src/apps/contacts/services/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ function getContactAsFormData(contact) {
return null
}

// default is that people are always marketable, unless opted out
if (!contact.hasOwnProperty('accepts_dit_email_marketing')) {
contact.accepts_dit_email_marketing = true
}

let result = {
id: contact.id,
company: contact.company.id,
Expand All @@ -29,7 +24,6 @@ function getContactAsFormData(contact) {
primary: contact.primary ? 'yes' : 'no',
full_telephone_number: contact.full_telephone_number,
email: contact.email,
accepts_dit_email_marketing: contact.accepts_dit_email_marketing,
address_same_as_company: contact.address_same_as_company ? 'yes' : 'no',
address_1: contact.address_1,
address_2: contact.address_2,
Expand Down
1 change: 0 additions & 1 deletion test/end-to-end/cypress/specs/DIT/companies-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ describe('Contacts', () => {
'Phone number': '44 0778877778800',
Address: '100 Path, A town, 12345, United States',
Email: '[email protected]',
'Email marketing': 'Cannot be marketed to',
})
})

Expand Down
11 changes: 0 additions & 11 deletions test/functional/cypress/specs/contacts/create-and-edit-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,6 @@ const assertRadioGroup = (label, option) =>
const assertRadioGroupNoOptionChecked = (label) =>
cy.contains(label).parent().find('input').should('not.be.checked')

const assertNoMarketingConsent = () =>
cy
.contains('The company contact does accept email marketing')
.parent()
.find('input')
.should('not.be.checked')

const NEW_CONTACT_ID = '14890695-ce54-4419-88d3-9224754ecbc0'
describe('Create contact form', () => {
beforeEach(() => {
Expand All @@ -63,8 +56,6 @@ describe('Create contact form', () => {
'Add contact at Zboncak Group|271eb29e-425b-4cd8-b386-3208c3a5f978': null,
})

assertNoMarketingConsent()

assertRadioGroupNoOptionChecked('Is this person a primary contact?')
assertRadioGroupNoOptionChecked(
'Is this contact’s work address the same as the company address?'
Expand Down Expand Up @@ -316,8 +307,6 @@ describe('Edit contact', () => {
`/companies/${ZBONCAK_COMPANY_ID}`
)

assertNoMarketingConsent()

assertRadioGroup('Is this person a primary contact?', 'Yes')
assertRadioGroup(
'Is this contact’s work address the same as the company address?',
Expand Down
2 changes: 0 additions & 2 deletions test/functional/cypress/specs/contacts/details-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ describe('View contact details', () => {
Address:
'3 Priory Court, Kingshill Road, Dursley, Gloucestershire, GL11 4DH, United Kingdom',
Email: companyAddresscontact.email,
'Email marketing': EMAIL_CONSENT_NO,
})
})
})
Expand All @@ -153,7 +152,6 @@ describe('View contact details', () => {
'123 Test Boulevard, Basney, US State, 9416875, United States',
Email: usContact.email,
'More details': usContact.notes,
'Email marketing': EMAIL_CONSENT_NO,
})
})
})
Expand Down

0 comments on commit 43b750b

Please sign in to comment.