From 7abd2c7a907a243ca845fc28a2bb5b6ba0aa93f2 Mon Sep 17 00:00:00 2001 From: Nathan Cannon Date: Tue, 5 Mar 2019 09:19:09 +0000 Subject: [PATCH] Added verification of websocket invocation --- .../controller/GroupSessionControllerTest.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/src/test/kotlin/uk/co/neviyn/observationdatabase/controller/GroupSessionControllerTest.kt b/backend/src/test/kotlin/uk/co/neviyn/observationdatabase/controller/GroupSessionControllerTest.kt index 6ae5952..f47682f 100644 --- a/backend/src/test/kotlin/uk/co/neviyn/observationdatabase/controller/GroupSessionControllerTest.kt +++ b/backend/src/test/kotlin/uk/co/neviyn/observationdatabase/controller/GroupSessionControllerTest.kt @@ -103,6 +103,7 @@ class GroupSessionControllerTest { controller.addGroupObservation(GroupObservation("A Student", listOf(scenario))) controller.pushObservationsToDatabase() verify(observationRepository, times(1)).save(any()) + verify(websocketMessenger, times(1)).convertAndSend("/ws/scenarios", mapOf("scenarios" to mapOf("Sample title" to listOf(scenario.copy(title = "A Student"))))) assertEquals(1, tutor.observations.size) } @@ -123,6 +124,7 @@ class GroupSessionControllerTest { controller.startGroupObservation(GroupObservationInit(1, TrainingType.INITIAL, listOf(1), listOf("Sample title"))) val rc = RatingComponent(rating = 5) controller.addGroupObservation(GroupObservation("A Student", listOf(Scenario(0, "Sample title", RatingComponent(rating = 0), rc, rc, rc, rc, rc, rc, rc)))) + verify(websocketMessenger, times(1)).convertAndSend("/ws/scenarios", mapOf("scenarios" to mapOf("Sample title" to listOf(Scenario(0, "A Student", RatingComponent(rating = 0), rc, rc, rc, rc, rc, rc, rc))))) controller.pushObservationsToDatabase() }