test(recipe): cover null serves/cookTimeMin and capitalised effort rejection

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-10 09:00:16 +02:00
parent 30ba53099c
commit dbc78a1883
2 changed files with 36 additions and 0 deletions

View File

@@ -161,6 +161,19 @@ class RecipeControllerTest {
verify(recipeService).deleteRecipe(HOUSEHOLD_ID, RECIPE_ID);
}
@Test
void createRecipeWithCapitalisedEffortShouldReturn400() throws Exception {
var body = """
{"name":"Test","effort":"Easy","tagIds":["%s"],"ingredients":[{"quantity":1,"unit":"g","newIngredientName":"x","sortOrder":0}]}
""".formatted(UUID.randomUUID());
mockMvc.perform(post("/v1/recipes")
.principal(() -> "sarah@example.com")
.contentType(org.springframework.http.MediaType.APPLICATION_JSON)
.content(body))
.andExpect(status().isBadRequest());
}
private RecipeCreateRequest sampleCreateRequest() {
var ingredientId = UUID.randomUUID();
return new RecipeCreateRequest(