Refined search code and wired up the client side search with server

This commit is contained in:
Rithvik Sriram 2026-01-16 22:05:13 +01:00
commit 1688e7fffa
3 changed files with 94 additions and 55 deletions

View file

@ -115,19 +115,21 @@ public class RecipeControllerTest {
// The number of recipes returned is the same as the entire input list
assertEquals(recipes.size(),
controller.getRecipes(
Optional.empty(),
Optional.empty(),
Optional.empty()).getBody().size());
Optional.of(List.of("en", "nl"))).getBody().size());;
}
@Test
@Tag("test-from-init-data")
public void getSomeRecipes() {
final int LIMIT = 5;
// The number of recipes returned is the same as the entire input list
// The number of recipes returned is the same as the limit
assertEquals(LIMIT,
controller.getRecipes(
Optional.empty(),
Optional.of(LIMIT)).getBody().size());
Optional.empty(),
Optional.of(LIMIT),
Optional.of(List.of("en"))).getBody().size());
}
@Test
@ -135,8 +137,10 @@ public class RecipeControllerTest {
public void getManyRecipesWithLocale() {
// The number of recipes returned is the same as the entire input list
assertEquals(recipes.size(),
controller.getRecipes(Optional.of(List.of("en", "nl")),
Optional.empty()).getBody().size());
controller.getRecipes(
Optional.empty(),
Optional.empty(),
Optional.of(List.of("en", "nl"))).getBody().size());
}
@Test
@ -144,18 +148,20 @@ public class RecipeControllerTest {
public void getNoRecipesWithLocale() {
// should have NO Dutch recipes (thank god)
assertEquals(0,
controller.getRecipes(Optional.of(List.of("nl")),
Optional.empty()).getBody().size());
controller.getRecipes(
Optional.empty(),
Optional.empty(),
Optional.of(List.of("nl"))).getBody().size());
}
@Test
@Tag("test-from-init-data")
public void getSomeRecipesWithLocale() {
final int LIMIT = 5;
// The number of recipes returned is the same as the entire input list
assertEquals(LIMIT,
controller.getRecipes(Optional.of(List.of("en", "nl")),
Optional.of(LIMIT)).getBody().size());
controller.getRecipes(
Optional.empty(),
Optional.of(LIMIT),
Optional.of(List.of("en", "nl"))).getBody().size());
}
@Test