Skip to content

Commit e3eb497

Browse files
Add test for checking invalid recovery token
1 parent ef0c66b commit e3eb497

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

test/end-to-end/webauthn.recover_account.test.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,5 +164,48 @@ describe("SuperTokens Webauthn Recover Account", () => {
164164
"ST_LOGS SESSION OVERRIDE ADD_AXIOS_INTERCEPTORS",
165165
]);
166166
});
167+
it("should show the error when the token is invalid", async () => {
168+
// Use the token to recover the account
169+
await openRecoveryWithToken(page, "test");
170+
171+
const errorTextContainer = await waitForSTElement(
172+
page,
173+
"[data-supertokens~='passkeyRecoverableErrorContainer']"
174+
);
175+
const errorText = await errorTextContainer.evaluate((el) => el.textContent);
176+
assert.strictEqual(
177+
errorText,
178+
"The token used for recovering the account is invalid. Please try with a different token or request a new one."
179+
);
180+
181+
assert.deepStrictEqual(consoleLogs, [
182+
"ST_LOGS SESSION OVERRIDE ADD_FETCH_INTERCEPTORS_AND_RETURN_MODIFIED_FETCH",
183+
"ST_LOGS SESSION OVERRIDE ADD_AXIOS_INTERCEPTORS",
184+
"ST_LOGS WEBAUTHN OVERRIDE GET REGISTER OPTIONS WITH SIGN UP",
185+
"ST_LOGS WEBAUTHN OVERRIDE GET REGISTER OPTIONS",
186+
"ST_LOGS WEBAUTHN PRE_API_HOOKS REGISTER_OPTIONS",
187+
"ST_LOGS WEBAUTHN OVERRIDE REGISTER CREDENTIAL",
188+
"ST_LOGS WEBAUTHN OVERRIDE SIGN UP",
189+
"ST_LOGS WEBAUTHN PRE_API_HOOKS SIGN_UP",
190+
"ST_LOGS SESSION ON_HANDLE_EVENT SESSION_CREATED",
191+
"ST_LOGS SESSION OVERRIDE GET_USER_ID",
192+
"ST_LOGS SUPERTOKENS GET_REDIRECTION_URL SUCCESS undefined",
193+
"ST_LOGS SESSION OVERRIDE GET_USER_ID",
194+
"ST_LOGS SESSION OVERRIDE SIGN_OUT",
195+
"ST_LOGS SESSION PRE_API_HOOKS SIGN_OUT",
196+
"ST_LOGS SESSION ON_HANDLE_EVENT SIGN_OUT",
197+
"ST_LOGS SESSION OVERRIDE ADD_FETCH_INTERCEPTORS_AND_RETURN_MODIFIED_FETCH",
198+
"ST_LOGS SESSION OVERRIDE ADD_AXIOS_INTERCEPTORS",
199+
"ST_LOGS WEBAUTHN GET_REDIRECTION_URL SEND_RECOVERY_EMAIL",
200+
"ST_LOGS WEBAUTHN OVERRIDE GENERATE RECOVER ACCOUNT TOKEN",
201+
"ST_LOGS WEBAUTHN PRE_API_HOOKS GENERATE_RECOVER_ACCOUNT_TOKEN",
202+
"ST_LOGS SESSION OVERRIDE ADD_FETCH_INTERCEPTORS_AND_RETURN_MODIFIED_FETCH",
203+
"ST_LOGS SESSION OVERRIDE ADD_AXIOS_INTERCEPTORS",
204+
"ST_LOGS WEBAUTHN OVERRIDE GET REGISTER OPTIONS",
205+
"ST_LOGS WEBAUTHN OVERRIDE GET REGISTER OPTIONS",
206+
"ST_LOGS WEBAUTHN PRE_API_HOOKS REGISTER_OPTIONS",
207+
"ST_LOGS WEBAUTHN PRE_API_HOOKS REGISTER_OPTIONS",
208+
]);
209+
});
167210
});
168211
});

0 commit comments

Comments
 (0)