@@ -545,6 +545,9 @@ func TestGenerateTokenAPIWithExpiredAccessToken(t *testing.T) {
545545 WebsiteDomain : "supertokens.io" ,
546546 },
547547 RecipeList : []supertokens.Recipe {
548+ emailverification .Init (evmodels.TypeInput {
549+ Mode : evmodels .ModeOptional ,
550+ }),
548551 Init (nil ),
549552 session .Init (& sessmodels.TypeInput {
550553 AntiCsrf : & customAntiCsrfVal ,
@@ -660,6 +663,7 @@ func TestProvidingYourOwnEmailCallBackAndMakeSureItsCalled(t *testing.T) {
660663 },
661664 RecipeList : []supertokens.Recipe {
662665 emailverification .Init (evmodels.TypeInput {
666+ Mode : evmodels .ModeOptional ,
663667 CreateAndSendCustomEmail : func (user evmodels.User , emailVerificationURLWithToken string , userContext supertokens.UserContext ) {
664668 userInfo = user
665669 emailToken = emailVerificationURLWithToken
@@ -731,6 +735,7 @@ func TestEmailVerifyApiWithValidInput(t *testing.T) {
731735 },
732736 RecipeList : []supertokens.Recipe {
733737 emailverification .Init (evmodels.TypeInput {
738+ Mode : evmodels .ModeOptional ,
734739 CreateAndSendCustomEmail : func (user evmodels.User , emailVerificationURLWithToken string , userContext supertokens.UserContext ) {
735740 token = strings .Split (strings .Split (emailVerificationURLWithToken , "?token=" )[1 ], "&rid=" )[0 ]
736741 },
@@ -812,6 +817,9 @@ func TestTheEmailVerifyApiWithInvalidTokenAndCheckError(t *testing.T) {
812817 WebsiteDomain : "supertokens.io" ,
813818 },
814819 RecipeList : []supertokens.Recipe {
820+ emailverification .Init (evmodels.TypeInput {
821+ Mode : evmodels .ModeOptional ,
822+ }),
815823 Init (nil ),
816824 session .Init (& sessmodels.TypeInput {
817825 AntiCsrf : & customAntiCsrfVal ,
@@ -861,6 +869,9 @@ func TestEmailVerifyAPIWithTokenOfNotTypeString(t *testing.T) {
861869 WebsiteDomain : "supertokens.io" ,
862870 },
863871 RecipeList : []supertokens.Recipe {
872+ emailverification .Init (evmodels.TypeInput {
873+ Mode : evmodels .ModeOptional ,
874+ }),
864875 Init (nil ),
865876 session .Init (& sessmodels.TypeInput {
866877 AntiCsrf : & customAntiCsrfVal ,
@@ -913,6 +924,7 @@ func TestThatTheHandlePostEmailVerificationCallBackIsCalledOnSuccessFullVerifica
913924 },
914925 RecipeList : []supertokens.Recipe {
915926 emailverification .Init (evmodels.TypeInput {
927+ Mode : evmodels .ModeOptional ,
916928 CreateAndSendCustomEmail : func (user evmodels.User , emailVerificationURLWithToken string , userContext supertokens.UserContext ) {
917929 token = strings .Split (strings .Split (emailVerificationURLWithToken , "?token=" )[1 ], "&rid=" )[0 ]
918930 },
@@ -1015,6 +1027,7 @@ func TestEmailVerifyWithValidInputUsingTheGetMehtod(t *testing.T) {
10151027 },
10161028 RecipeList : []supertokens.Recipe {
10171029 emailverification .Init (evmodels.TypeInput {
1030+ Mode : evmodels .ModeOptional ,
10181031 CreateAndSendCustomEmail : func (user evmodels.User , emailVerificationURLWithToken string , userContext supertokens.UserContext ) {
10191032 token = strings .Split (strings .Split (emailVerificationURLWithToken , "?token=" )[1 ], "&rid=" )[0 ]
10201033 },
@@ -1116,6 +1129,9 @@ func TestVerifySessionWithNoSessionUsingTheGetMethod(t *testing.T) {
11161129 WebsiteDomain : "supertokens.io" ,
11171130 },
11181131 RecipeList : []supertokens.Recipe {
1132+ emailverification .Init (evmodels.TypeInput {
1133+ Mode : evmodels .ModeOptional ,
1134+ }),
11191135 Init (nil ),
11201136 session .Init (& sessmodels.TypeInput {
11211137 AntiCsrf : & customAntiCsrfVal ,
@@ -1168,6 +1184,7 @@ func TestTheEmailVerifyAPIwithValidInputOverridingAPIs(t *testing.T) {
11681184 },
11691185 RecipeList : []supertokens.Recipe {
11701186 emailverification .Init (evmodels.TypeInput {
1187+ Mode : evmodels .ModeOptional ,
11711188 CreateAndSendCustomEmail : func (user evmodels.User , emailVerificationURLWithToken string , userContext supertokens.UserContext ) {
11721189 token = strings .Split (strings .Split (emailVerificationURLWithToken , "?token=" )[1 ], "&rid=" )[0 ]
11731190 },
@@ -1270,6 +1287,7 @@ func TestTheEmailVerifyAPIwithValidInputAndOverridingFunctions(t *testing.T) {
12701287 },
12711288 RecipeList : []supertokens.Recipe {
12721289 emailverification .Init (evmodels.TypeInput {
1290+ Mode : evmodels .ModeOptional ,
12731291 CreateAndSendCustomEmail : func (user evmodels.User , emailVerificationURLWithToken string , userContext supertokens.UserContext ) {
12741292 token = strings .Split (strings .Split (emailVerificationURLWithToken , "?token=" )[1 ], "&rid=" )[0 ]
12751293 },
@@ -1372,6 +1390,7 @@ func TestTheEmailVerifyAPIwithValidInputThrowsErrorOnSuchOverriding(t *testing.T
13721390 },
13731391 RecipeList : []supertokens.Recipe {
13741392 emailverification .Init (evmodels.TypeInput {
1393+ Mode : evmodels .ModeOptional ,
13751394 CreateAndSendCustomEmail : func (user evmodels.User , emailVerificationURLWithToken string , userContext supertokens.UserContext ) {
13761395 token = strings .Split (strings .Split (emailVerificationURLWithToken , "?token=" )[1 ], "&rid=" )[0 ]
13771396 },
@@ -1472,6 +1491,7 @@ func TestTheEmailVerifyAPIWithValidInputOverridingFunctionsThrowsError(t *testin
14721491 },
14731492 RecipeList : []supertokens.Recipe {
14741493 emailverification .Init (evmodels.TypeInput {
1494+ Mode : evmodels .ModeOptional ,
14751495 CreateAndSendCustomEmail : func (user evmodels.User , emailVerificationURLWithToken string , userContext supertokens.UserContext ) {
14761496 token = strings .Split (strings .Split (emailVerificationURLWithToken , "?token=" )[1 ], "&rid=" )[0 ]
14771497 },
@@ -1570,8 +1590,10 @@ func TestTheGenerateTokenAPIWithValidInputAndThenRemoveToken(t *testing.T) {
15701590 WebsiteDomain : "supertokens.io" ,
15711591 },
15721592 RecipeList : []supertokens.Recipe {
1593+ emailverification .Init (evmodels.TypeInput {
1594+ Mode : evmodels .ModeOptional ,
1595+ }),
15731596 Init (nil ),
1574- emailverification .Init (evmodels.TypeInput {}),
15751597 session .Init (& sessmodels.TypeInput {
15761598 AntiCsrf : & customAntiCsrfVal ,
15771599 }),
@@ -1623,6 +1645,7 @@ func TestTheGenerateTokenAPIWithValidInputAndThenRemoveToken(t *testing.T) {
16231645 emailverification .RevokeEmailVerificationTokens (userId .(string ), nil )
16241646
16251647 res1 , err := emailverification .VerifyEmailUsingToken (verifyToken )
1626- assert .Nil (t , res1 )
1627- 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 )
16281651}
0 commit comments