From c28735a98b74c8ae04d35e575a3d55d471964f49 Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Sat, 9 Sep 2023 15:22:00 -0600 Subject: [PATCH] improve custom matcher and fix test --- .../_auth+/auth.$provider.callback.test.ts | 2 -- app/routes/_auth+/verify.tsx | 5 ---- tests/setup/custom-matchers.ts | 23 ++++++++++++++++++- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/app/routes/_auth+/auth.$provider.callback.test.ts b/app/routes/_auth+/auth.$provider.callback.test.ts index 32a8ab442..a54c03bad 100644 --- a/app/routes/_auth+/auth.$provider.callback.test.ts +++ b/app/routes/_auth+/auth.$provider.callback.test.ts @@ -206,9 +206,7 @@ test('if a user is not logged in, but the connection exists and they have enable type: twoFAVerificationType, target: userId, redirectTo: '/', - remember: 'on', }) - searchParams.sort() expect(response).toHaveRedirect(`/verify?${searchParams}`) }) diff --git a/app/routes/_auth+/verify.tsx b/app/routes/_auth+/verify.tsx index bf9bf5c11..a0555a54c 100644 --- a/app/routes/_auth+/verify.tsx +++ b/app/routes/_auth+/verify.tsx @@ -31,7 +31,6 @@ export const codeQueryParam = 'code' export const targetQueryParam = 'target' export const typeQueryParam = 'type' export const redirectToQueryParam = 'redirectTo' -export const rememberQueryParam = 'remember' const types = ['onboarding', 'reset-password', 'change-email', '2fa'] as const const VerificationTypeSchema = z.enum(types) export type VerificationTypes = z.infer @@ -238,7 +237,6 @@ async function validateRequest( export default function VerifyRoute() { const data = useLoaderData() const [searchParams] = useSearchParams() - const remember = searchParams.get(rememberQueryParam) const isPending = useIsPending() const actionData = useActionData() const type = VerificationTypeSchema.parse(searchParams.get(typeQueryParam)) @@ -312,9 +310,6 @@ export default function VerifyRoute() { type: 'hidden', })} /> - {remember === 'on' ? ( - - ) : null} `Expected response to ${ this.isNot ? 'not ' : ''