From b3ea95f732d5ff85d83b722b084b25896c1324c9 Mon Sep 17 00:00:00 2001 From: Kirill Kamakin Date: Sun, 6 Nov 2022 15:56:26 +0100 Subject: [PATCH] Update recipe repo --- .../mealient/data/recipes/impl/RecipeRepoTest.kt | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/app/src/test/java/gq/kirmanak/mealient/data/recipes/impl/RecipeRepoTest.kt b/app/src/test/java/gq/kirmanak/mealient/data/recipes/impl/RecipeRepoTest.kt index 468b589..bc63779 100644 --- a/app/src/test/java/gq/kirmanak/mealient/data/recipes/impl/RecipeRepoTest.kt +++ b/app/src/test/java/gq/kirmanak/mealient/data/recipes/impl/RecipeRepoTest.kt @@ -46,28 +46,18 @@ class RecipeRepoTest { @Test fun `when loadRecipeInfo expect return value from data source`() = runTest { - coEvery { dataSource.requestRecipeInfo(eq("cake")) } returns CAKE_FULL_RECIPE_INFO coEvery { storage.queryRecipeInfo(eq("1")) } returns FULL_CAKE_INFO_ENTITY - val actual = subject.loadRecipeInfo("1", "cake") + val actual = subject.loadRecipeInfo("1") assertThat(actual).isEqualTo(FULL_CAKE_INFO_ENTITY) } @Test - fun `when loadRecipeInfo expect call to storage`() = runTest { + fun `when refreshRecipeInfo expect call to storage`() = runTest { coEvery { dataSource.requestRecipeInfo(eq("cake")) } returns CAKE_FULL_RECIPE_INFO - coEvery { storage.queryRecipeInfo(eq("1")) } returns FULL_CAKE_INFO_ENTITY - subject.loadRecipeInfo("1", "cake") + subject.refreshRecipeInfo("cake") coVerify { storage.saveRecipeInfo(eq(CAKE_FULL_RECIPE_INFO)) } } - @Test - fun `when data source fails expect loadRecipeInfo return value from storage`() = runTest { - coEvery { dataSource.requestRecipeInfo(eq("cake")) } throws RuntimeException() - coEvery { storage.queryRecipeInfo(eq("1")) } returns FULL_CAKE_INFO_ENTITY - val actual = subject.loadRecipeInfo("1", "cake") - assertThat(actual).isEqualTo(FULL_CAKE_INFO_ENTITY) - } - @Test fun `when clearLocalData expect call to storage`() = runTest { subject.clearLocalData()