From 928c93286998c958aa93ccfc7b3c9eef27cd1b34 Mon Sep 17 00:00:00 2001 From: Geir Eilertsen Date: Mon, 16 Dec 2024 14:13:06 +0100 Subject: [PATCH] Fixed test --- .../src/main/resources/static/index.html | 1 + .../marvin/robot/domain/brain/BrainResponderTest.java | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/marvin.interaction.web/src/main/resources/static/index.html b/marvin.interaction.web/src/main/resources/static/index.html index 1dad5ef..3495832 100644 --- a/marvin.interaction.web/src/main/resources/static/index.html +++ b/marvin.interaction.web/src/main/resources/static/index.html @@ -105,6 +105,7 @@ } messageList.appendChild(newMessage); messageList.appendChild(document.createElement("div")).style.clear = "both"; + newMessage.scrollIntoView({ behavior: "smooth" }); if (sender !== "User") { const senderHeader = document.createElement("span"); diff --git a/marvin.robot.core/src/test/java/com/assetvisor/marvin/robot/domain/brain/BrainResponderTest.java b/marvin.robot.core/src/test/java/com/assetvisor/marvin/robot/domain/brain/BrainResponderTest.java index 4cd7db8..5f5499a 100644 --- a/marvin.robot.core/src/test/java/com/assetvisor/marvin/robot/domain/brain/BrainResponderTest.java +++ b/marvin.robot.core/src/test/java/com/assetvisor/marvin/robot/domain/brain/BrainResponderTest.java @@ -7,6 +7,7 @@ import com.assetvisor.marvin.robot.domain.communication.ForCheckingIfAnybodyIsListening; import com.assetvisor.marvin.robot.domain.communication.ForConvertingTextToSpeech; import com.assetvisor.marvin.robot.domain.communication.ForMessaging; +import com.assetvisor.marvin.robot.domain.communication.Message; import com.assetvisor.marvin.robot.domain.communication.SpeechBuffer; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -31,16 +32,16 @@ public class BrainResponderTest { @Test public void shouldRespond() { // Given - String message = "message"; + Message message = new Message("Marvin", "message"); byte[] bytes = {1, 2, 3}; - given(forConvertingTextToSpeech.convert(message)).willReturn(bytes); + given(forConvertingTextToSpeech.convert(message.content())).willReturn(bytes); given(forCheckingIfAnybodyIsListening.isAnybodyListening()).willReturn(true); // When - brainResponder.respond(message); + brainResponder.respond(message.content()); // Then - verify(forConvertingTextToSpeech).convert(message); + verify(forConvertingTextToSpeech).convert(message.content()); verify(speechBuffer).add(bytes); verify(forMessaging).message(message); verifyNoMoreInteractions(forMessaging, forConvertingTextToSpeech, speechBuffer);