-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6315 from espoon-voltti/discussion-survey-notific…
…ation-fix Korjataan keskustelukyselyiden sähköpostimuistus jos lapsi on varahoidossa
- Loading branch information
Showing
2 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -40,6 +40,7 @@ import fi.espoo.evaka.shared.async.AsyncJobRunner | |
import fi.espoo.evaka.shared.auth.AuthenticatedUser | ||
import fi.espoo.evaka.shared.auth.CitizenAuthLevel | ||
import fi.espoo.evaka.shared.auth.UserRole | ||
import fi.espoo.evaka.shared.dev.DevBackupCare | ||
import fi.espoo.evaka.shared.dev.DevCalendarEvent | ||
import fi.espoo.evaka.shared.dev.DevCalendarEventAttendee | ||
import fi.espoo.evaka.shared.dev.DevCalendarEventTime | ||
|
@@ -1913,6 +1914,73 @@ class CalendarEventServiceIntegrationTest : FullApplicationTest(resetDbBeforeEac | |
assertEmails(expectedRecipients, notificationEmailContent, expectedFromAddress) | ||
} | ||
|
||
@Test | ||
fun `notifications are sent even child in backup care`() { | ||
val email = "[email protected]" | ||
db.transaction { tx -> | ||
// Email address is needed | ||
tx.updatePersonalDetails( | ||
testAdult_1.id, | ||
PersonalDataUpdate( | ||
preferredName = "", | ||
phone = "", | ||
backupPhone = "", | ||
email = "[email protected]", | ||
), | ||
) | ||
} | ||
db.transaction { tx -> | ||
tx.insert( | ||
DevBackupCare( | ||
childId = testChild_1.id, | ||
unitId = testDaycare2.id, | ||
groupId = groupId2, | ||
period = FiniteDateRange(placementStart, placementEnd), | ||
) | ||
) | ||
} | ||
|
||
val form = | ||
CalendarEventForm( | ||
unitId = testDaycare.id, | ||
tree = mapOf(groupId to setOf(testChild_1.id)), | ||
title = "Group survey", | ||
description = "gsu", | ||
period = FiniteDateRange(today.plusDays(3), today.plusDays(3)), | ||
eventType = CalendarEventType.DISCUSSION_SURVEY, | ||
times = | ||
listOf( | ||
CalendarEventTimeForm( | ||
date = today.plusDays(1), | ||
timeRange = TimeRange(LocalTime.of(8, 0), LocalTime.of(9, 0)), | ||
) | ||
), | ||
) | ||
|
||
val event = createCalendarEvent(form) | ||
|
||
calendarEventNotificationService.scheduleDiscussionSurveyDigests(db, now) | ||
|
||
asyncJobRunner.runPendingJobsSync(RealEvakaClock()) | ||
|
||
val expectedRecipients = listOf(testAdult_1.copy(email = email)) | ||
|
||
val emailDetails = | ||
DiscussionSurveyCreationNotificationData( | ||
eventId = event.id, | ||
eventTitle = HtmlSafe(event.title), | ||
eventDescription = HtmlSafe(event.description), | ||
) | ||
|
||
val notificationEmailContent = | ||
emailMessageProvider.discussionSurveyCreationNotification( | ||
language = Language.fi, | ||
notificationDetails = emailDetails, | ||
) | ||
val expectedFromAddress = "${emailEnv.senderNameFi} <${emailEnv.senderAddress}>" | ||
assertEmails(expectedRecipients, notificationEmailContent, expectedFromAddress) | ||
} | ||
|
||
@Test | ||
fun `reminder sent for impending discussion time reservation`() { | ||
val email = "[email protected]" | ||
|
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