generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PI-2646 remove moj footer if present
- Loading branch information
1 parent
133373b
commit 68bfdf6
Showing
4 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
...s/justice-email-and-delius/src/dev/resources/messages/successful-message-with-footer.json
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,7 @@ | ||
{ | ||
"id": "00000000-0000-0000-0000-000000000000", | ||
"subject": "A000001 was involved in an incident", | ||
"bodyContent": "Example message\n\nThis e-mail and any attachments is intended only for the attention of the addressee(s). Its unauthorised use, disclosure, storage or copying is not permitted. If you are not the intended recipient, please destroy all copies and inform the sender by return e-mail. Internet e-mail is not a secure medium. Any reply to this message could be intercepted and read by someone else. Please bear that in mind when deciding whether to send material in response to this message by e-mail. This e-mail (whether you are the sender or the recipient) may be monitored, recorded and retained by the Ministry of Justice. Monitoring / blocking software may be used, and e-mail content may be read at any time. You have a responsibility to ensure laws are not broken when composing or forwarding e-mails and their contents.", | ||
"fromEmailAddress": "[email protected]", | ||
"receivedDateTime": "2025-01-10T10:24:56Z[Europe/London]" | ||
} |
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 |
---|---|---|
|
@@ -64,6 +64,34 @@ internal class IntegrationTest { | |
assertThat(contact.providerId, equalTo(Data.MANAGER.providerId)) | ||
} | ||
|
||
@Test | ||
fun `moj footer is removed if present`() { | ||
val notification = Notification(get<EmailMessage>("successful-message-with-footer")) | ||
handler.handle(notification) | ||
verify(telemetryService).notificationReceived(notification) | ||
|
||
val contact = verifyContactCreated() | ||
assertThat(contact.type.code, equalTo(EMAIL.code)) | ||
assertThat(contact.description, equalTo("Email - was involved in an incident")) | ||
assertThat( | ||
contact.notes, equalTo( | ||
""" | ||
|This contact was created automatically from a forwarded email sent by [email protected] at 10:24 on 10/01/2025. | ||
|Subject: A000001 was involved in an incident | ||
| | ||
|Example message | ||
|""".trimMargin() | ||
) | ||
) | ||
assertThat( | ||
contact.externalReference, | ||
equalTo("urn:uk:gov:hmpps:justice-email:00000000-0000-0000-0000-000000000000") | ||
) | ||
assertThat(contact.staffId, equalTo(Data.STAFF.id)) | ||
assertThat(contact.teamId, equalTo(Data.MANAGER.teamId)) | ||
assertThat(contact.providerId, equalTo(Data.MANAGER.providerId)) | ||
} | ||
|
||
@Test | ||
fun `description is truncated if over 200 chars`() { | ||
val notification = Notification(get<EmailMessage>("successful-long-message")) | ||
|
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
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