From ad128326500b5923203e0c295622113eb0b012a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mih=C3=A1ly=20Lengyel?= Date: Mon, 16 Oct 2023 13:29:33 +0200 Subject: [PATCH] test: update tests that check when the ev claim is updated (#723) --- .../emailverificationapis.test.js | 18 ++++++------------ test/emailpassword/emailverify.test.js | 2 +- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/test/accountlinking/emailverificationapis.test.js b/test/accountlinking/emailverificationapis.test.js index 6216a3f67..70f815613 100644 --- a/test/accountlinking/emailverificationapis.test.js +++ b/test/accountlinking/emailverificationapis.test.js @@ -478,7 +478,7 @@ describe(`emailverificationapiTests: ${printPath("[test/accountlinking/emailveri }); describe("isEmailVerifiedGET tests", function () { - it("calling isEmailVerifiedGET gives false for currently logged in user if email is not verified, and does not update session", async function () { + it("calling isEmailVerifiedGET gives false for currently logged in user if email is not verified, and updates session", async function () { const connectionURI = await startSTWithMultitenancyAndAccountLinking(); supertokens.init({ supertokens: { @@ -555,12 +555,10 @@ describe(`emailverificationapiTests: ${printPath("[test/accountlinking/emailveri assert(response.body.isVerified === false); let tokens = extractInfoFromResponse(response); - assert(tokens.accessToken === undefined); - assert(tokens.accessTokenFromAny === undefined); - assert(tokens.accessTokenFromHeader === undefined); + assert.notStrictEqual(tokens.accessTokenFromAny, undefined); }); - it("calling isEmailVerifiedGET gives true for currently logged in user if email is verified, and does not update session", async function () { + it("calling isEmailVerifiedGET gives true for currently logged in user if email is verified, and updates session", async function () { const connectionURI = await startSTWithMultitenancyAndAccountLinking(); supertokens.init({ supertokens: { @@ -643,9 +641,7 @@ describe(`emailverificationapiTests: ${printPath("[test/accountlinking/emailveri assert(response.body.isVerified === true); let tokens = extractInfoFromResponse(response); - assert(tokens.accessToken === undefined); - assert(tokens.accessTokenFromAny === undefined); - assert(tokens.accessTokenFromHeader === undefined); + assert.notStrictEqual(tokens.accessTokenFromAny, undefined); }); it("calling isEmailVerifiedGET gives false for currently logged in user if email is not verified, and updates session if needed", async function () { @@ -928,7 +924,7 @@ describe(`emailverificationapiTests: ${printPath("[test/accountlinking/emailveri assert(userInCallback.recipeUserId.getAsString() === epUser.loginMethods[0].recipeUserId.getAsString()); }); - it("calling generateEmailVerifyTokenPOST gives already verified for currently logged in user if email is verified, and does not update session", async function () { + it("calling generateEmailVerifyTokenPOST gives already verified for currently logged in user if email is verified, and updates session", async function () { let userInCallback = undefined; const connectionURI = await startSTWithMultitenancyAndAccountLinking(); supertokens.init({ @@ -1021,9 +1017,7 @@ describe(`emailverificationapiTests: ${printPath("[test/accountlinking/emailveri assert(response.body.status === "EMAIL_ALREADY_VERIFIED_ERROR"); let tokens = extractInfoFromResponse(response); - assert(tokens.accessToken === undefined); - assert(tokens.accessTokenFromAny === undefined); - assert(tokens.accessTokenFromHeader === undefined); + assert.notStrictEqual(tokens.accessTokenFromAny, undefined); assert(userInCallback === undefined); }); diff --git a/test/emailpassword/emailverify.test.js b/test/emailpassword/emailverify.test.js index dbb1359fc..e5a1618fb 100644 --- a/test/emailpassword/emailverify.test.js +++ b/test/emailpassword/emailverify.test.js @@ -1408,7 +1408,7 @@ describe(`emailverify: ${printPath("[test/emailpassword/emailverify.test.js]")}` let infoFromResponse2 = extractInfoFromResponse(response); assert.strictEqual(response.statusCode, 200); assert.deepStrictEqual(response.body.status, "EMAIL_ALREADY_VERIFIED_ERROR"); - assert.strictEqual(infoFromResponse2.frontToken, undefined); + assert.notStrictEqual(infoFromResponse2.frontToken, undefined); // now we mark the email as unverified and try again await EmailVerification.unverifyEmail(userId, emailId);