Skip to content

Commit 9c06d50

Browse files
authored
Merge pull request #5905 from espoon-voltti/flaky-test-fix
Korjaa testin
2 parents 8e52e7c + 33bba1c commit 9c06d50

File tree

1 file changed

+31
-18
lines changed

1 file changed

+31
-18
lines changed

service/src/integrationTest/kotlin/fi/espoo/evaka/occupancy/OccupancyControllerIntegrationTest.kt

+31-18
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,12 @@ class OccupancyControllerIntegrationTest : FullApplicationTest(resetDbBeforeEach
960960
RealtimeOccupancy(
961961
childAttendances =
962962
listOf(
963+
ChildOccupancyAttendance(
964+
childId = testChild_3.id,
965+
arrived = HelsinkiDateTime.of(today, LocalTime.of(9, 0)),
966+
departed = HelsinkiDateTime.of(today, LocalTime.of(14, 0)),
967+
capacity = 1.0,
968+
),
963969
ChildOccupancyAttendance(
964970
childId = testChild_1.id,
965971
arrived = HelsinkiDateTime.of(today, LocalTime.of(9, 15)),
@@ -972,12 +978,6 @@ class OccupancyControllerIntegrationTest : FullApplicationTest(resetDbBeforeEach
972978
departed = null,
973979
capacity = 0.5,
974980
),
975-
ChildOccupancyAttendance(
976-
childId = testChild_3.id,
977-
arrived = HelsinkiDateTime.of(today, LocalTime.of(9, 0)),
978-
departed = HelsinkiDateTime.of(today, LocalTime.of(14, 0)),
979-
capacity = 1.0,
980-
),
981981
),
982982
staffAttendances =
983983
listOf(
@@ -986,16 +986,16 @@ class OccupancyControllerIntegrationTest : FullApplicationTest(resetDbBeforeEach
986986
departed = HelsinkiDateTime.of(today, LocalTime.of(14, 0)),
987987
capacity = 7.0,
988988
),
989-
StaffOccupancyAttendance(
990-
arrived = HelsinkiDateTime.of(today, LocalTime.of(10, 0)),
991-
departed = null,
992-
capacity = 0.0,
993-
),
994989
StaffOccupancyAttendance(
995990
arrived = HelsinkiDateTime.of(today, LocalTime.of(8, 30)),
996991
departed = HelsinkiDateTime.of(today, LocalTime.of(15, 0)),
997992
capacity = 7.0,
998993
),
994+
StaffOccupancyAttendance(
995+
arrived = HelsinkiDateTime.of(today, LocalTime.of(10, 0)),
996+
departed = null,
997+
capacity = 0.0,
998+
),
999999
),
10001000
),
10011001
occupanciesForUnit,
@@ -1092,11 +1092,24 @@ class OccupancyControllerIntegrationTest : FullApplicationTest(resetDbBeforeEach
10921092
)
10931093

10941094
private fun getUnitRealizedOccupanciesForDay(date: LocalDate, groupIds: List<GroupId>?) =
1095-
occupancyController.getUnitRealizedOccupanciesForDay(
1096-
dbInstance(),
1097-
AuthenticatedUser.Employee(testDecisionMaker_1.id, setOf(UserRole.SERVICE_WORKER)),
1098-
mockClock,
1099-
testDaycare.id,
1100-
OccupancyController.GetUnitOccupanciesForDayBody(date, groupIds),
1101-
)
1095+
occupancyController
1096+
.getUnitRealizedOccupanciesForDay(
1097+
dbInstance(),
1098+
AuthenticatedUser.Employee(testDecisionMaker_1.id, setOf(UserRole.SERVICE_WORKER)),
1099+
mockClock,
1100+
testDaycare.id,
1101+
OccupancyController.GetUnitOccupanciesForDayBody(date, groupIds),
1102+
)
1103+
.let { occupancies ->
1104+
occupancies.copy(
1105+
childAttendances =
1106+
occupancies.childAttendances.sortedWith(
1107+
compareBy({ it.arrived }, { it.departed })
1108+
),
1109+
staffAttendances =
1110+
occupancies.staffAttendances.sortedWith(
1111+
compareBy({ it.arrived }, { it.departed })
1112+
),
1113+
)
1114+
}
11021115
}

0 commit comments

Comments
 (0)