-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,12 +6,18 @@ | |
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.stream.Stream; | ||
import net.pengcook.authentication.domain.UserInfo; | ||
import net.pengcook.category.dto.RecipeOfCategoryRequest; | ||
import net.pengcook.category.service.CategoryService; | ||
import net.pengcook.ingredient.domain.Requirement; | ||
import net.pengcook.ingredient.dto.IngredientCreateRequest; | ||
import net.pengcook.ingredient.service.IngredientRecipeService; | ||
import net.pengcook.ingredient.service.IngredientService; | ||
import net.pengcook.ingredient.service.IngredientSubstitutionService; | ||
import net.pengcook.recipe.dto.MainRecipeResponse; | ||
import net.pengcook.recipe.dto.RecipeRequest; | ||
import net.pengcook.recipe.dto.RecipeResponse; | ||
import net.pengcook.recipe.dto.RecipeStepRequest; | ||
import net.pengcook.recipe.dto.RecipeStepResponse; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
|
@@ -42,6 +48,32 @@ void readRecipes(int pageNumber, int pageSize, int expectedFirstRecipeId) { | |
assertThat(mainRecipeResponses.getFirst().recipeId()).isEqualTo(expectedFirstRecipeId); | ||
} | ||
|
||
@Test | ||
@DisplayName("μλ‘μ΄ λ μνΌλ₯Ό μμ±νλ€.") | ||
void createRecipe() { | ||
UserInfo userInfo = new UserInfo(1L, "[email protected]"); | ||
|
||
List<String> categories = List.of("Dessert", "NewCategory"); | ||
List<String> substitutions = List.of("Water", "Orange"); | ||
List<IngredientCreateRequest> ingredients = List.of( | ||
new IngredientCreateRequest("Apple", Requirement.REQUIRED, substitutions), | ||
new IngredientCreateRequest("WaterMelon", Requirement.OPTIONAL, null) | ||
); | ||
RecipeRequest recipeRequest = new RecipeRequest( | ||
"μλ‘μ΄ λ μνΌ μ λͺ©", | ||
"00:30:00", | ||
"λ μνΌ μΈλ€μΌ.jpg", | ||
4, | ||
"μλ‘μ΄ λ μνΌ μ€λͺ ", | ||
categories, | ||
ingredients | ||
); | ||
|
||
RecipeResponse recipe = recipeService.createRecipe(userInfo, recipeRequest); | ||
|
||
assertThat(recipe.recipeId()).isEqualTo(16L); | ||
} | ||
|
||
@Test | ||
@DisplayName("νΉμ λ μνΌμ μ€ν μ sequence μμλ‘ μ‘°ννλ€.") | ||
void readRecipeSteps() { | ||
|
@@ -57,6 +89,31 @@ void readRecipeSteps() { | |
assertThat(recipeStepResponses).isEqualTo(expectedRecipeStepResponses); | ||
} | ||
|
||
@Test | ||
@DisplayName("νΉμ λ μνΌμ νΉμ λ μνΌ μ€ν μ μ‘°ννλ€.") | ||
void readRecipeStep() { | ||
RecipeStepResponse recipeStepResponse = recipeService.readRecipeStep(1L, 1L); | ||
|
||
assertAll( | ||
() -> assertThat(recipeStepResponse.recipeId()).isEqualTo(1L), | ||
() -> assertThat(recipeStepResponse.description()).isEqualTo("λ μνΌ1 μ€λͺ 1") | ||
); | ||
|
||
} | ||
|
||
@Test | ||
@DisplayName("νΉμ λ μνΌμ λ μνΌ μ€ν μ μμ±νλ€.") | ||
void createRecipeStep() { | ||
RecipeStepRequest recipeStepRequest = new RecipeStepRequest("μλ‘μ΄ μ€ν μ΄λ―Έμ§.jpg", "μλ‘μ΄ μ€ν μ€λͺ ", 1, "00:05:00"); | ||
|
||
RecipeStepResponse recipeStepResponse = recipeService.createRecipeStep(2L, recipeStepRequest); | ||
|
||
assertAll( | ||
() -> assertThat(recipeStepResponse.recipeId()).isEqualTo(2L), | ||
() -> assertThat(recipeStepResponse.description()).isEqualTo("μλ‘μ΄ μ€ν μ€λͺ ") | ||
); | ||
} | ||
|
||
@ParameterizedTest | ||
@MethodSource("provideParameters") | ||
@DisplayName("νΉμ μΉ΄ν κ³ λ¦¬μ λ μνΌλ₯Ό μ°Ύλλ€.") | ||
|