Skip to content

Commit 647d83a

Browse files
authored
Fix unit tests (#775)
1 parent 4f50dbc commit 647d83a

File tree

10 files changed

+47
-14
lines changed

10 files changed

+47
-14
lines changed

test/unit/componentOverrides.test.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ import { SendVerifyEmail } from "../../lib/ts/recipe/emailverification/component
4242
import { VerifyEmailLinkClicked } from "../../lib/ts/recipe/emailverification/components/themes/emailVerification/verifyEmailLinkClicked";
4343
import { Header as ThirdPartyEmailPasswordHeader } from "../../lib/ts/recipe/thirdpartyemailpassword/components/themes/signInAndUp/header";
4444
import { Header as ThirdPartyPasswordlessHeader } from "../../lib/ts/recipe/thirdpartypasswordless/components/themes/signInUp/header";
45-
import { CloseTabScreen } from "../../lib/ts/recipe/passwordless/components/themes/signInUp/closeTabScreen";
4645
import { ComponentOverride } from "../../lib/ts/components/componentOverride/componentOverride";
4746
import { LinkClickedScreen } from "../../lib/ts/recipe/passwordless/components/themes/linkClickedScreen";
4847
import { LinkSent } from "../../lib/ts/recipe/passwordless/components/themes/signInUp/linkSent";
@@ -101,7 +100,6 @@ describe("Theme component overrides", () => {
101100
PasswordlessUserInputCodeFormFooter_Override: UserInputCodeFormFooter,
102101
PasswordlessUserInputCodeFormHeader_Override: UserInputCodeFormHeader,
103102
PasswordlessLinkSent_Override: LinkSent,
104-
PasswordlessCloseTabScreen_Override: CloseTabScreen,
105103
PasswordlessLinkClickedScreen_Override: LinkClickedScreen,
106104
ThirdPartyPasswordlessHeader_Override: ThirdPartyPasswordlessHeader,
107105
};

test/unit/recipe/emailpassword/emailPassword.test.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -635,9 +635,11 @@ describe("EmailPassword", function () {
635635
}).authReact(SuperTokens.getInstanceOrThrow().appInfo, false);
636636

637637
assert(
638-
(await EmailPassword.getInstanceOrThrow().getRedirectUrl({ action: "SUCCESS", isNewRecipeUser: false })) ===
639-
null
638+
(await EmailPassword.getInstanceOrThrow().getRedirectUrl(
639+
{ action: "SUCCESS", isNewRecipeUser: false, isNewPrimaryUser: false },
640+
{}
641+
)) === null
640642
);
641-
assert((await EmailPassword.getInstanceOrThrow().getRedirectUrl({ action: "RESET_PASSWORD" })) === null);
643+
assert((await EmailPassword.getInstanceOrThrow().getRedirectUrl({ action: "RESET_PASSWORD" }, {})) === null);
642644
});
643645
});

test/unit/recipe/emailpassword/signInUp.test.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,12 @@ describe("EmailPassword.SignInAndUp", () => {
7373
expect(MockSession.validateGlobalClaimsAndHandleSuccessRedirection).toHaveBeenCalledWith(
7474
{
7575
rid: "emailpassword",
76-
successRedirectContext: { action: "SUCCESS", isNewRecipeUser: false, redirectToPath: undefined },
76+
successRedirectContext: {
77+
action: "SUCCESS",
78+
isNewRecipeUser: false,
79+
isNewPrimaryUser: false,
80+
redirectToPath: undefined,
81+
},
7782
},
7883
{},
7984
undefined

test/unit/recipe/passwordless/passwordless.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ describe("Passwordless", function () {
140140
assert.throws(() => Passwordless.getInstanceOrThrow().config.onHandleEvent({} as any), {
141141
message: "ON HANDLE EVENTS HOOK THROWS",
142142
});
143-
assert.throws(() => Passwordless.getInstanceOrThrow().config.getRedirectionURL({} as any), {
143+
assert.throws(() => Passwordless.getInstanceOrThrow().config.getRedirectionURL({} as any, {}), {
144144
message: "GET REDIRECTION HOOK THROWS",
145145
});
146146
});

test/unit/recipe/passwordless/signInUp.test.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,12 @@ describe("Passwordless.SingInUp", () => {
7474
expect(MockSession.validateGlobalClaimsAndHandleSuccessRedirection).toHaveBeenCalledWith(
7575
{
7676
rid: "passwordless",
77-
successRedirectContext: { action: "SUCCESS", isNewRecipeUser: false, redirectToPath: undefined },
77+
successRedirectContext: {
78+
action: "SUCCESS",
79+
isNewRecipeUser: false,
80+
isNewPrimaryUser: false,
81+
redirectToPath: undefined,
82+
},
7883
},
7984
{},
8085
undefined

test/unit/recipe/session/sessionAuth.test.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,11 @@ describe("SessionAuth", () => {
611611
]);
612612

613613
// then
614-
expect(mockRedirectToAuth).toHaveBeenLastCalledWith({ redirectBack: true, history: undefined });
614+
expect(mockRedirectToAuth).toHaveBeenLastCalledWith({
615+
redirectBack: true,
616+
navigate: undefined,
617+
userContext: {},
618+
});
615619
});
616620

617621
test("not redirect on UNAUTHORISED if doRedirection=false", async () => {
@@ -673,7 +677,11 @@ describe("SessionAuth", () => {
673677

674678
// then
675679
expect(child).not.toBeInTheDocument();
676-
expect(mockRedirectToAuth).toHaveBeenLastCalledWith({ redirectBack: true, history: undefined });
680+
expect(mockRedirectToAuth).toHaveBeenLastCalledWith({
681+
redirectBack: true,
682+
navigate: undefined,
683+
userContext: {},
684+
});
677685
});
678686

679687
test("not redirect on session load if doRedirection=false", async () => {

test/unit/recipe/thirdparty/signInUp.test.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,12 @@ describe("ThirdParty.SignInAndUp", () => {
8585
expect(MockSession.validateGlobalClaimsAndHandleSuccessRedirection).toHaveBeenCalledWith(
8686
{
8787
rid: "thirdparty",
88-
successRedirectContext: { action: "SUCCESS", isNewRecipeUser: false, redirectToPath: undefined },
88+
successRedirectContext: {
89+
action: "SUCCESS",
90+
isNewRecipeUser: false,
91+
isNewPrimaryUser: false,
92+
redirectToPath: undefined,
93+
},
8994
},
9095
{},
9196
undefined

test/unit/recipe/thirdparty/thirdParty.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ describe("ThirdParty", function () {
363363
assert.throws(() => ThirdParty.getInstanceOrThrow().config.onHandleEvent({} as any), {
364364
message: "ON HANDLE EVENTS HOOK THROWS",
365365
});
366-
assert.throws(() => ThirdParty.getInstanceOrThrow().config.getRedirectionURL({} as any), {
366+
assert.throws(() => ThirdParty.getInstanceOrThrow().config.getRedirectionURL({} as any, {}), {
367367
message: "GET REDIRECTION HOOK THROWS",
368368
});
369369
});

test/unit/recipe/thirdpartyemailpassword/signInUp.test.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,12 @@ describe("ThirdPartyEmailPassword.SignInAndUp", () => {
7373
expect(MockSession.validateGlobalClaimsAndHandleSuccessRedirection).toHaveBeenCalledWith(
7474
{
7575
rid: "thirdpartyemailpassword",
76-
successRedirectContext: { action: "SUCCESS", isNewRecipeUser: false, redirectToPath: undefined },
76+
successRedirectContext: {
77+
action: "SUCCESS",
78+
isNewRecipeUser: false,
79+
isNewPrimaryUser: false,
80+
redirectToPath: undefined,
81+
},
7782
},
7883
{},
7984
undefined

test/unit/recipe/thirdpartypasswordless/signInUp.test.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,12 @@ describe("ThirdPartyPasswordless.SignInAndUp", () => {
7474
expect(MockSession.validateGlobalClaimsAndHandleSuccessRedirection).toHaveBeenCalledWith(
7575
{
7676
rid: "thirdpartypasswordless",
77-
successRedirectContext: { action: "SUCCESS", isNewRecipeUser: false, redirectToPath: undefined },
77+
successRedirectContext: {
78+
action: "SUCCESS",
79+
isNewRecipeUser: false,
80+
isNewPrimaryUser: false,
81+
redirectToPath: undefined,
82+
},
7883
},
7984
{},
8085
undefined

0 commit comments

Comments
 (0)