Skip to content

Commit

Permalink
fix: updated test
Browse files Browse the repository at this point in the history
  • Loading branch information
sattvikc committed Sep 7, 2023
1 parent 408e36a commit d1262d3
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions src/test/java/io/supertokens/test/FeatureFlagTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -925,10 +925,13 @@ public void testAccountLinkingStatsWithDifferentStorages() throws Exception {
AuthRecipeUserInfo user1 = EmailPassword.signUp(ts, process.getProcess(), "[email protected]", "password");
AuthRecipeUserInfo user2 = EmailPassword.signUp(ts, process.getProcess(), "[email protected]", "password");
AuthRecipeUserInfo user3 = EmailPassword.signUp(ts, process.getProcess(), "[email protected]", "password");
AuthRecipeUserInfo user4 = EmailPassword.signUp(ts, process.getProcess(), "[email protected]", "password");
AuthRecipeUserInfo user5 = EmailPassword.signUp(ts, process.getProcess(), "[email protected]", "password");

AuthRecipe.createPrimaryUser(process.getProcess(), ts.toAppIdentifierWithStorage(), user1.getSupertokensUserId());
AuthRecipe.linkAccounts(process.getProcess(), ts.toAppIdentifierWithStorage(), user2.getSupertokensUserId(), user1.getSupertokensUserId());
AuthRecipe.createPrimaryUser(process.getProcess(), ts.toAppIdentifierWithStorage(), user3.getSupertokensUserId());
AuthRecipe.linkAccounts(process.getProcess(), ts.toAppIdentifierWithStorage(), user4.getSupertokensUserId(), user3.getSupertokensUserId());
}

{ // tenant 1
Expand Down Expand Up @@ -995,6 +998,28 @@ public void testAccountLinkingStatsWithDifferentStorages() throws Exception {
responseBody.addProperty("email", "[email protected]");
responseBody.addProperty("password", "password");

JsonObject signInResponse = HttpRequestForTesting.sendJsonPOSTRequest(process.getProcess(), "",
"http://localhost:3567/t1/recipe/signin", responseBody, 1000, 1000, null, SemVer.v4_0.get(),
"emailpassword");

assertEquals(signInResponse.get("status").getAsString(), "OK");
}
{
JsonObject responseBody = new JsonObject();
responseBody.addProperty("email", "[email protected]");
responseBody.addProperty("password", "password");

JsonObject signInResponse = HttpRequestForTesting.sendJsonPOSTRequest(process.getProcess(), "",
"http://localhost:3567/t1/recipe/signin", responseBody, 1000, 1000, null, SemVer.v4_0.get(),
"emailpassword");

assertEquals(signInResponse.get("status").getAsString(), "OK");
}
{
JsonObject responseBody = new JsonObject();
responseBody.addProperty("email", "[email protected]");
responseBody.addProperty("password", "password");

JsonObject signInResponse = HttpRequestForTesting.sendJsonPOSTRequest(process.getProcess(), "",
"http://localhost:3567/t1/recipe/signin", responseBody, 1000, 1000, null, SemVer.v4_0.get(),
"emailpassword");
Expand All @@ -1015,11 +1040,11 @@ public void testAccountLinkingStatsWithDifferentStorages() throws Exception {

assertEquals(3, alStats.entrySet().size());
assertTrue(alStats.get("usesAccountLinking").getAsBoolean());
assertEquals(2, alStats.get("totalUserCountWithMoreThanOneLoginMethod").getAsInt());
assertEquals(3, alStats.get("totalUserCountWithMoreThanOneLoginMethod").getAsInt());

JsonArray maus = alStats.get("mauWithMoreThanOneLoginMethod").getAsJsonArray();
assertEquals(30, maus.size());
assertEquals(2, maus.get(0).getAsInt());
assertEquals(3, maus.get(0).getAsInt());
}

process.kill();
Expand Down

0 comments on commit d1262d3

Please sign in to comment.