@@ -491,6 +491,9 @@ func TestGenerateTokenAPIWithValidInputNoSessionAndCheckOutput(t *testing.T) {
491491 WebsiteDomain : "supertokens.io" ,
492492 },
493493 RecipeList : []supertokens.Recipe {
494+ emailverification .Init (evmodels.TypeInput {
495+ Mode : evmodels .ModeOptional ,
496+ }),
494497 Init (nil ),
495498 session .Init (& sessmodels.TypeInput {
496499 AntiCsrf : & customAntiCsrfVal ,
@@ -542,6 +545,9 @@ func TestGenerateTokenAPIWithExpiredAccessToken(t *testing.T) {
542545 WebsiteDomain : "supertokens.io" ,
543546 },
544547 RecipeList : []supertokens.Recipe {
548+ emailverification .Init (evmodels.TypeInput {
549+ Mode : evmodels .ModeOptional ,
550+ }),
545551 Init (nil ),
546552 session .Init (& sessmodels.TypeInput {
547553 AntiCsrf : & customAntiCsrfVal ,
@@ -657,6 +663,7 @@ func TestProvidingYourOwnEmailCallBackAndMakeSureItsCalled(t *testing.T) {
657663 },
658664 RecipeList : []supertokens.Recipe {
659665 emailverification .Init (evmodels.TypeInput {
666+ Mode : evmodels .ModeOptional ,
660667 CreateAndSendCustomEmail : func (user evmodels.User , emailVerificationURLWithToken string , userContext supertokens.UserContext ) {
661668 userInfo = user
662669 emailToken = emailVerificationURLWithToken
@@ -728,6 +735,7 @@ func TestEmailVerifyApiWithValidInput(t *testing.T) {
728735 },
729736 RecipeList : []supertokens.Recipe {
730737 emailverification .Init (evmodels.TypeInput {
738+ Mode : evmodels .ModeOptional ,
731739 CreateAndSendCustomEmail : func (user evmodels.User , emailVerificationURLWithToken string , userContext supertokens.UserContext ) {
732740 token = strings .Split (strings .Split (emailVerificationURLWithToken , "?token=" )[1 ], "&rid=" )[0 ]
733741 },
@@ -809,6 +817,9 @@ func TestTheEmailVerifyApiWithInvalidTokenAndCheckError(t *testing.T) {
809817 WebsiteDomain : "supertokens.io" ,
810818 },
811819 RecipeList : []supertokens.Recipe {
820+ emailverification .Init (evmodels.TypeInput {
821+ Mode : evmodels .ModeOptional ,
822+ }),
812823 Init (nil ),
813824 session .Init (& sessmodels.TypeInput {
814825 AntiCsrf : & customAntiCsrfVal ,
@@ -858,6 +869,9 @@ func TestEmailVerifyAPIWithTokenOfNotTypeString(t *testing.T) {
858869 WebsiteDomain : "supertokens.io" ,
859870 },
860871 RecipeList : []supertokens.Recipe {
872+ emailverification .Init (evmodels.TypeInput {
873+ Mode : evmodels .ModeOptional ,
874+ }),
861875 Init (nil ),
862876 session .Init (& sessmodels.TypeInput {
863877 AntiCsrf : & customAntiCsrfVal ,
@@ -910,6 +924,7 @@ func TestThatTheHandlePostEmailVerificationCallBackIsCalledOnSuccessFullVerifica
910924 },
911925 RecipeList : []supertokens.Recipe {
912926 emailverification .Init (evmodels.TypeInput {
927+ Mode : evmodels .ModeOptional ,
913928 CreateAndSendCustomEmail : func (user evmodels.User , emailVerificationURLWithToken string , userContext supertokens.UserContext ) {
914929 token = strings .Split (strings .Split (emailVerificationURLWithToken , "?token=" )[1 ], "&rid=" )[0 ]
915930 },
@@ -1012,6 +1027,7 @@ func TestEmailVerifyWithValidInputUsingTheGetMehtod(t *testing.T) {
10121027 },
10131028 RecipeList : []supertokens.Recipe {
10141029 emailverification .Init (evmodels.TypeInput {
1030+ Mode : evmodels .ModeOptional ,
10151031 CreateAndSendCustomEmail : func (user evmodels.User , emailVerificationURLWithToken string , userContext supertokens.UserContext ) {
10161032 token = strings .Split (strings .Split (emailVerificationURLWithToken , "?token=" )[1 ], "&rid=" )[0 ]
10171033 },
@@ -1113,6 +1129,9 @@ func TestVerifySessionWithNoSessionUsingTheGetMethod(t *testing.T) {
11131129 WebsiteDomain : "supertokens.io" ,
11141130 },
11151131 RecipeList : []supertokens.Recipe {
1132+ emailverification .Init (evmodels.TypeInput {
1133+ Mode : evmodels .ModeOptional ,
1134+ }),
11161135 Init (nil ),
11171136 session .Init (& sessmodels.TypeInput {
11181137 AntiCsrf : & customAntiCsrfVal ,
@@ -1165,6 +1184,7 @@ func TestTheEmailVerifyAPIwithValidInputOverridingAPIs(t *testing.T) {
11651184 },
11661185 RecipeList : []supertokens.Recipe {
11671186 emailverification .Init (evmodels.TypeInput {
1187+ Mode : evmodels .ModeOptional ,
11681188 CreateAndSendCustomEmail : func (user evmodels.User , emailVerificationURLWithToken string , userContext supertokens.UserContext ) {
11691189 token = strings .Split (strings .Split (emailVerificationURLWithToken , "?token=" )[1 ], "&rid=" )[0 ]
11701190 },
@@ -1267,6 +1287,7 @@ func TestTheEmailVerifyAPIwithValidInputAndOverridingFunctions(t *testing.T) {
12671287 },
12681288 RecipeList : []supertokens.Recipe {
12691289 emailverification .Init (evmodels.TypeInput {
1290+ Mode : evmodels .ModeOptional ,
12701291 CreateAndSendCustomEmail : func (user evmodels.User , emailVerificationURLWithToken string , userContext supertokens.UserContext ) {
12711292 token = strings .Split (strings .Split (emailVerificationURLWithToken , "?token=" )[1 ], "&rid=" )[0 ]
12721293 },
@@ -1369,6 +1390,7 @@ func TestTheEmailVerifyAPIwithValidInputThrowsErrorOnSuchOverriding(t *testing.T
13691390 },
13701391 RecipeList : []supertokens.Recipe {
13711392 emailverification .Init (evmodels.TypeInput {
1393+ Mode : evmodels .ModeOptional ,
13721394 CreateAndSendCustomEmail : func (user evmodels.User , emailVerificationURLWithToken string , userContext supertokens.UserContext ) {
13731395 token = strings .Split (strings .Split (emailVerificationURLWithToken , "?token=" )[1 ], "&rid=" )[0 ]
13741396 },
@@ -1469,6 +1491,7 @@ func TestTheEmailVerifyAPIWithValidInputOverridingFunctionsThrowsError(t *testin
14691491 },
14701492 RecipeList : []supertokens.Recipe {
14711493 emailverification .Init (evmodels.TypeInput {
1494+ Mode : evmodels .ModeOptional ,
14721495 CreateAndSendCustomEmail : func (user evmodels.User , emailVerificationURLWithToken string , userContext supertokens.UserContext ) {
14731496 token = strings .Split (strings .Split (emailVerificationURLWithToken , "?token=" )[1 ], "&rid=" )[0 ]
14741497 },
@@ -1567,8 +1590,10 @@ func TestTheGenerateTokenAPIWithValidInputAndThenRemoveToken(t *testing.T) {
15671590 WebsiteDomain : "supertokens.io" ,
15681591 },
15691592 RecipeList : []supertokens.Recipe {
1593+ emailverification .Init (evmodels.TypeInput {
1594+ Mode : evmodels .ModeOptional ,
1595+ }),
15701596 Init (nil ),
1571- emailverification .Init (evmodels.TypeInput {}),
15721597 session .Init (& sessmodels.TypeInput {
15731598 AntiCsrf : & customAntiCsrfVal ,
15741599 }),
@@ -1620,6 +1645,7 @@ func TestTheGenerateTokenAPIWithValidInputAndThenRemoveToken(t *testing.T) {
16201645 emailverification .RevokeEmailVerificationTokens (userId .(string ), nil )
16211646
16221647 res1 , err := emailverification .VerifyEmailUsingToken (verifyToken )
1623- assert .Nil (t , res1 )
1624- assert .Equal (t , "email verification token is invalid" , err .Error ())
1648+ assert .NoError (t , err )
1649+ assert .NotNil (t , res1 .EmailVerificationInvalidTokenError )
1650+ assert .Nil (t , res1 .OK )
16251651}
0 commit comments