Skip to content

Commit e3eba44

Browse files
Add fix for existing user failing to be signed up
1 parent b7b9b13 commit e3eba44

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

test/end-to-end/signin.test.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ import {
6161
setupCoreApp,
6262
setupST,
6363
} from "../helpers";
64-
import { SOMETHING_WENT_WRONG_ERROR } from "../constants";
64+
import { SOMETHING_WENT_WRONG_ERROR, TEST_APPLICATION_SERVER_BASE_URL } from "../constants";
6565
import { EMAIL_EXISTS_API, SIGN_IN_API, TEST_CLIENT_BASE_URL, SIGN_OUT_API } from "../constants";
6666

6767
/*
@@ -563,6 +563,15 @@ describe("SuperTokens SignIn", function () {
563563

564564
describe("Successful Sign In with redirect to, with EmailPasswordAuth", async function () {
565565
it("First sign in", async function () {
566+
await fetch(`${TEST_APPLICATION_SERVER_BASE_URL}/deleteUser`, {
567+
method: "POST",
568+
headers: [["content-type", "application/json"]],
569+
body: JSON.stringify({
570+
571+
rid: "emailpassword",
572+
}),
573+
});
574+
566575
await toggleSignInSignUp(page);
567576
await defaultSignUp(page);
568577
consoleLogs = await clearBrowserCookiesWithoutAffectingConsole(page, consoleLogs);

test/server/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,9 @@ app.post("/deleteUser", async (req, res) => {
788788
res.status(400).send({ message: "Not implemented" });
789789
}
790790
const user = await EmailPassword.getUserByEmail("public", req.body.email);
791+
if (user === undefined) {
792+
res.status(404).send({ message: "User not found" });
793+
}
791794
res.send(await SuperTokens.deleteUser(user.id));
792795
});
793796

0 commit comments

Comments
 (0)