feat: topics, recipe messages

This commit is contained in:
Natalia Cholewa 2025-12-04 22:52:14 +01:00
commit 8e24e47813
7 changed files with 160 additions and 7 deletions

View file

@ -9,6 +9,7 @@ import org.junit.jupiter.api.TestInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.http.HttpStatus;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.test.context.ActiveProfiles;
import server.database.RecipeRepository;
@ -30,6 +31,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
// This config uses an in-memory database
@ActiveProfiles("mock-data-test")
public class RecipeControllerTest {
@Autowired
private SimpMessagingTemplate template;
private RecipeController controller;
private List<Recipe> recipes;
private final RecipeRepository recipeRepository;
@ -48,7 +53,7 @@ public class RecipeControllerTest {
.range(0, NUM_RECIPES)
.mapToObj(x -> new Recipe(null, "Recipe " + x, List.of(), List.of()))
.toList();
controller = new RecipeController(recipeRepository);
controller = new RecipeController(recipeRepository, template);
Set<String> tags = info.getTags();
List<Long> ids = new ArrayList<>();