diff --git a/app/presenters/notifications/setup/download-recipients.presenter.js b/app/presenters/notifications/setup/download-recipients.presenter.js index 6aceb10d62..1757bea45b 100644 --- a/app/presenters/notifications/setup/download-recipients.presenter.js +++ b/app/presenters/notifications/setup/download-recipients.presenter.js @@ -64,9 +64,8 @@ function _transformForCsv(recipients) { 'Returns due date': formatDateObjectToISO(recipient.due_date), 'Message type': contact ? 'letter' : 'email', 'Message reference': 'invitations', - 'Licence holder': contact ? contactName(recipient.contact) : '', - 'Recipient name': '', Email: recipient.email || '', + 'Recipient name': contact ? contactName(recipient.contact) : '', ..._address(contact) } }) diff --git a/test/presenters/notifications/setup/download-recipients.presenter.test.js b/test/presenters/notifications/setup/download-recipients.presenter.test.js index 48f9ea7b99..22f18320a1 100644 --- a/test/presenters/notifications/setup/download-recipients.presenter.test.js +++ b/test/presenters/notifications/setup/download-recipients.presenter.test.js @@ -28,15 +28,15 @@ describe('Notifications Setup - Download recipients presenter', () => { expect(result).to.equal( // Headers - '"Licences","Return references","Returns period start date","Returns period end date","Returns due date","Message type","Message reference","Licence holder","Recipient name","Email","Address line 1","Address line 2","Address line 3","Address line 4","Address line 5","Address line 6","Postcode"\n' + + '"Licences","Return references","Returns period start date","Returns period end date","Returns due date","Message type","Message reference","Email","Recipient name","Address line 1","Address line 2","Address line 3","Address line 4","Address line 5","Address line 6","Postcode"\n' + // Row - Primary user - '"123/46","2434","2018-01-01","2019-01-01","2021-01-01","email","invitations",,,"primary.user@important.com",,,,,,,\n' + + '"123/46","2434","2018-01-01","2019-01-01","2021-01-01","email","invitations","primary.user@important.com",,,,,,,,\n' + // Row - Licence holder - '"1/343/3","376439279","2018-01-01","2019-01-01","2021-01-01","letter","invitations","Mr J Licence holder only",,,"4","Privet Drive","Line 3","Line 4","Little Whinging","United Kingdom","WD25 7LR"\n' + + '"1/343/3","376439279","2018-01-01","2019-01-01","2021-01-01","letter","invitations",,"Mr J Licence holder only","4","Privet Drive","Line 3","Line 4","Little Whinging","United Kingdom","WD25 7LR"\n' + // Row - Returns to - '"1/343/3","376439279","2018-01-01","2019-01-01","2021-01-01","letter","invitations","Mr J Returns to (same licence ref as licence holder)",,,"4","Privet Drive","Line 3","Line 4","Surrey","United Kingdom","WD25 7LR"\n' + + '"1/343/3","376439279","2018-01-01","2019-01-01","2021-01-01","letter","invitations",,"Mr J Returns to (same licence ref as licence holder)","4","Privet Drive","Line 3","Line 4","Surrey","United Kingdom","WD25 7LR"\n' + // Row - Licence holder - organisation - '"1/343/3","376439279","2018-01-01","2019-01-01","2021-01-01","letter","invitations","Gringotts",,,"4","Privet Drive","Line 3","Line 4","Little Whinging","United Kingdom","WD25 7LR"\n' + '"1/343/3","376439279","2018-01-01","2019-01-01","2021-01-01","letter","invitations",,"Gringotts","4","Privet Drive","Line 3","Line 4","Little Whinging","United Kingdom","WD25 7LR"\n' ) }) @@ -55,9 +55,8 @@ describe('Notifications Setup - Download recipients presenter', () => { '"Returns due date",' + '"Message type",' + '"Message reference",' + - '"Licence holder",' + - '"Recipient name",' + '"Email",' + + '"Recipient name",' + '"Address line 1",' + '"Address line 2",' + '"Address line 3",' + @@ -85,9 +84,8 @@ describe('Notifications Setup - Download recipients presenter', () => { '"2021-01-01",' + // 'Returns due date' '"email",' + // 'Message type' '"invitations",' + // 'Message reference' - ',' + // 'Licence holder' - ',' + // 'Recipient name' '"primary.user@important.com",' + // Email + ',' + // 'Recipient name'' ',' + // 'Address line 1' ',' + // 'Address line 2' ',' + // 'Address line 3' @@ -117,9 +115,8 @@ describe('Notifications Setup - Download recipients presenter', () => { '"2021-01-01",' + // 'Returns due date' '"letter",' + // 'Message type' '"invitations",' + // 'Message reference' - '"Mr J Licence holder only",' + // 'Licence holder' - ',' + // 'Recipient name' ',' + // Email + '"Mr J Licence holder only",' + // 'Recipient name'' '"4",' + // 'Address line 1' '"Privet Drive",' + // 'Address line 2' '"Line 3",' + // 'Address line 3' @@ -148,9 +145,8 @@ describe('Notifications Setup - Download recipients presenter', () => { '"2021-01-01",' + // 'Returns due date' '"letter",' + // 'Message type' '"invitations",' + // 'Message reference' - '"Mr J Returns to (same licence ref as licence holder)",' + // 'Licence holder' - ',' + // 'Recipient name' ',' + // Email + '"Mr J Returns to (same licence ref as licence holder)",' + // 'Recipient name'' '"4",' + // 'Address line 1' '"Privet Drive",' + // 'Address line 2' '"Line 3",' + // 'Address line 3' @@ -180,9 +176,8 @@ describe('Notifications Setup - Download recipients presenter', () => { '"2021-01-01",' + // 'Returns due date' '"letter",' + // 'Message type' '"invitations",' + // 'Message reference' - '"Gringotts",' + // 'Licence holder' - organisation - ',' + // 'Recipient name' ',' + // Email + '"Gringotts",' + // 'Recipient name'' - organisation '"4",' + // 'Address line 1' '"Privet Drive",' + // 'Address line 2' '"Line 3",' + // 'Address line 3' diff --git a/test/services/notifications/setup/download-recipients.service.test.js b/test/services/notifications/setup/download-recipients.service.test.js index 99eaa50aee..50e579ee69 100644 --- a/test/services/notifications/setup/download-recipients.service.test.js +++ b/test/services/notifications/setup/download-recipients.service.test.js @@ -44,9 +44,9 @@ describe('Notifications Setup - Download recipients service', () => { expect(result).to.equal({ data: // Headers - '"Licences","Return references","Returns period start date","Returns period end date","Returns due date","Message type","Message reference","Licence holder","Recipient name","Email","Address line 1","Address line 2","Address line 3","Address line 4","Address line 5","Address line 6","Postcode"\n' + + '"Licences","Return references","Returns period start date","Returns period end date","Returns due date","Message type","Message reference","Email","Recipient name","Address line 1","Address line 2","Address line 3","Address line 4","Address line 5","Address line 6","Postcode"\n' + // Row - licence holder - '"1/343/3","376439279","2018-01-01","2019-01-01","2021-01-01","letter","invitations","Mr J Licence holder only",,,"4","Privet Drive","Line 3","Line 4","Little Whinging","United Kingdom","WD25 7LR"\n', + '"1/343/3","376439279","2018-01-01","2019-01-01","2021-01-01","letter","invitations",,"Mr J Licence holder only","4","Privet Drive","Line 3","Line 4","Little Whinging","United Kingdom","WD25 7LR"\n', filename: `Returns invitation - ${referenceCode}.csv`, type: 'text/csv' })