Skip to content

Commit 519fed1

Browse files
Add fix for existing user failing to be signed up
1 parent 2623d7f commit 519fed1

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ import {
5959
setupCoreApp,
6060
setupST,
6161
} from "../helpers";
62-
import { SOMETHING_WENT_WRONG_ERROR } from "../constants";
62+
import { SOMETHING_WENT_WRONG_ERROR, TEST_APPLICATION_SERVER_BASE_URL } from "../constants";
6363
import { EMAIL_EXISTS_API, SIGN_IN_API, TEST_CLIENT_BASE_URL, SIGN_OUT_API } from "../constants";
6464

6565
/*
@@ -628,6 +628,15 @@ describe("SuperTokens SignIn", function () {
628628

629629
describe("Successful Sign In with redirect to, with EmailPasswordAuth", async function () {
630630
it("First sign in", async function () {
631+
await fetch(`${TEST_APPLICATION_SERVER_BASE_URL}/deleteUser`, {
632+
method: "POST",
633+
headers: [["content-type", "application/json"]],
634+
body: JSON.stringify({
635+
636+
rid: "emailpassword",
637+
}),
638+
});
639+
631640
await toggleSignInSignUp(page);
632641
await defaultSignUp(page);
633642
consoleLogs = await clearBrowserCookiesWithoutAffectingConsole(page, consoleLogs);

test/server/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,10 @@ app.post("/deleteUser", async (req, res) => {
806806
}
807807

808808
const users = await SuperTokens.listUsersByAccountInfo("public", req.body);
809+
if (users.length === 0) {
810+
res.status(404).send({ message: "User not found" });
811+
return;
812+
}
809813
res.send(await SuperTokens.deleteUser(users[0].id));
810814
});
811815

0 commit comments

Comments
 (0)