@@ -280,8 +280,14 @@ describe("SuperTokens Account linking", function () {
280280 const email = `test-user+${ Date . now ( ) } @supertokens.com` ;
281281
282282 await setAccountLinkingConfig ( true , false ) ;
283- // 1. Sign up without account linking with an unverified tp user & log out
283+ // 1. Sign up without account linking with an unverified ep and tp users & log out
284+ // We need both, because when setting up the pwless user we'll link to the older one
285+ await tryThirdPartySignInUp ( page , email , false ) ;
286+ await Promise . all ( [ page . waitForSelector ( ".sessionInfo-user-id" ) , page . waitForNetworkIdle ( ) ] ) ;
287+ await logOut ( page ) ;
288+
284289 await tryEmailPasswordSignUp ( page , email ) ;
290+ await Promise . all ( [ page . waitForSelector ( ".sessionInfo-user-id" ) , page . waitForNetworkIdle ( ) ] ) ;
285291 await logOut ( page ) ;
286292
287293 await setAccountLinkingConfig ( true , true , false ) ;
@@ -377,6 +383,8 @@ describe("SuperTokens Account linking", function () {
377383 const email = `test-user+${ Date . now ( ) } @supertokens.com` ;
378384
379385 await setAccountLinkingConfig ( true , false ) ;
386+ await tryEmailPasswordSignUp ( page , email ) ;
387+ await logOut ( page ) ;
380388 // 1. Sign up without account linking with an unverified tp user & log out
381389 await tryThirdPartySignInUp ( page , email , false ) ;
382390 await logOut ( page ) ;
@@ -429,42 +437,6 @@ describe("SuperTokens Account linking", function () {
429437 assert . strictEqual ( new URL ( page . url ( ) ) . pathname , "/auth/" ) ;
430438 } ) ;
431439
432- it ( "should not allow sign up w/ passwordless after changing the email if it conflicts with an unverified user" , async function ( ) {
433- const email = `test-user+${ Date . now ( ) } @supertokens.com` ;
434- const email2 = `test-user-2+${ Date . now ( ) } @supertokens.com` ;
435-
436- await setAccountLinkingConfig ( true , false ) ;
437- // 1. Sign up without account linking with an unverified tp user & log out
438- await tryEmailPasswordSignUp ( page , email ) ;
439- await logOut ( page ) ;
440-
441- // 2. Sign up with passwordless
442- await tryPasswordlessSignInUp ( page , email2 ) ;
443- await Promise . all ( [ page . waitForSelector ( ".sessionInfo-user-id" ) , page . waitForNetworkIdle ( ) ] ) ;
444- const accessTokenPayload = await page . evaluate ( ( ) =>
445- window . __supertokensSessionRecipe . getAccessTokenPayloadSecurely ( )
446- ) ;
447- const userId = accessTokenPayload . sub ;
448- await logOut ( page ) ;
449-
450- await page . evaluate ( ( ) => localStorage . removeItem ( "supertokens-passwordless-loginAttemptInfo" ) ) ;
451- await Promise . all ( [
452- page . goto ( `${ TEST_CLIENT_BASE_URL } /auth/?authRecipe=passwordless` ) ,
453- page . waitForNavigation ( { waitUntil : "networkidle0" } ) ,
454- ] ) ;
455- await changeEmail ( "passwordless" , userId , email ) ;
456- await setAccountLinkingConfig ( true , true , true ) ;
457-
458- await setInputValues ( page , [ { name : "emailOrPhone" , value : email } ] ) ;
459- await submitForm ( page ) ;
460-
461- assert . strictEqual (
462- await getGeneralError ( page ) ,
463- "Cannot sign in / up due to security reasons. Please try a different login method or contact support. (ERR_CODE_003)"
464- ) ;
465- assert . strictEqual ( new URL ( page . url ( ) ) . pathname , "/auth/" ) ;
466- } ) ;
467-
468440 it ( "should not allow sign up w/ passwordless if it conflicts with an unverified user" , async function ( ) {
469441 const email = `test-user+${ Date . now ( ) } @supertokens.com` ;
470442
0 commit comments