Skip to content

Commit

Permalink
Merge pull request #151 from ucsd-cse110-fa23/MS2-E2E
Browse files Browse the repository at this point in the history
One end 2 end scenario testing.
  • Loading branch information
Earth34r authored Dec 6, 2023
2 parents c8ffc78 + 26638e3 commit 75d0926
Showing 1 changed file with 35 additions and 33 deletions.
68 changes: 35 additions & 33 deletions src/test/java/E2ETest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,49 +30,51 @@
*/


// class E2ETest {
class E2ETest {

// @Test
// void testEnd2EndScenario() throws IOException, InterruptedException, URISyntaxException {
// Authentication auth = new MockAuthentication();
@Test
void testEnd2EndScenario() throws IOException, InterruptedException, URISyntaxException {
MockAuthentication auth = new MockAuthentication();
Model model = mock(Model.class);

// auth.mockCreateUser("test", "test", "test", "test", "test");
// Boolean verifyUser = auth.verifyUser("test", "test");
// assertFalse(verifyUser);
auth.createUser("test", "test", "test", "test", "test");
Boolean verifyUser = auth.verifyUser("test", "test");
assertTrue(verifyUser);

// auth.markAutoLoginStatus("test");
// String autoLogin = auth.SkipLoginIfRemembered();
// assertEquals(autoLogin, null);
auth.markAutoLoginStatus("test");
String autoLogin = auth.SkipLoginIfRemembered();
assertEquals(autoLogin, null);

// MockChatGPT chatGPT = new MockChatGPT();
MockChatGPT chatGPT = new MockChatGPT();

// JSONObject recipe = chatGPT.generateRecipe("Ingredients");
// assertNotNull(recipe);
JSONObject recipe = chatGPT.generateRecipe("Ingredients");
assertNotNull(recipe);

// RecipeDetailPage recipeDetailPage = mock(RecipeDetailPage.class);
// recipeDetailPage.updateResponse(recipe);
// recipeDetailPage.update();
RecipeDetailPage recipeDetailPage = mock(RecipeDetailPage.class);
recipeDetailPage.updateResponse(recipe);
recipeDetailPage.update();

// assertNull(recipeDetailPage.getResponse());
// String image = chatGPT.generateImage("Image");
assertNull(recipeDetailPage.getResponse());
String image = chatGPT.generateImage("Image");

// RecipeCard recipeCard = mock(RecipeCard.class);
// recipeCard.setImage(image);
RecipeCard recipeCard = mock(RecipeCard.class);
recipeCard.setImage(image);

// recipeCard.addRecipeDetail(recipeDetailPage);
// assertNull(recipeCard.getRecipeDetailPage());
recipeCard.addRecipeDetail(recipeDetailPage);
assertNull(recipeCard.getRecipeDetailPage());

// JSONObject recipe2 = chatGPT.generateRecipe("Recipe2");
JSONObject recipe2 = chatGPT.generateRecipe("Recipe2");

// recipeDetailPage.updateResponse(recipe2);
// recipeDetailPage.update();
// recipeCard.addRecipeDetail(recipeDetailPage);
// assertNull(recipeDetailPage.getResponse());
// assertNull(recipeCard.getRecipeDetailPage());
recipeDetailPage.updateResponse(recipe2);
recipeDetailPage.update();
recipeCard.addRecipeDetail(recipeDetailPage);
assertNull(recipeDetailPage.getResponse());
assertNull(recipeCard.getRecipeDetailPage());

// MockDatabase database = new MockDatabase();
// database.insert(recipe2);
MockDatabase database = new MockDatabase();
database.insert(recipe2);

// JSONObject retrievedRecipe = database.get("test");
// }
// }
JSONObject retrievedRecipe = database.get("test");
assertNull(retrievedRecipe);
}
}

0 comments on commit 75d0926

Please sign in to comment.