Skip to content

Commit 00af1b1

Browse files
committed
chore(react): Remove redundant api
1 parent c797e14 commit 00af1b1

File tree

2 files changed

+0
-118
lines changed

2 files changed

+0
-118
lines changed

packages/react/src/hooks.test.tsx

Lines changed: 0 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,13 @@
1616

1717
import { describe, it, expect, vi, beforeEach } from "vitest";
1818
import { renderHook, act, cleanup, waitFor } from "@testing-library/react";
19-
import React from "react";
2019
import {
2120
useUI,
2221
useRedirectError,
2322
useSignInAuthFormSchema,
2423
useSignUpAuthFormSchema,
2524
useForgotPasswordAuthFormSchema,
2625
useEmailLinkAuthFormSchema,
27-
useMultiFactorPhoneAuthAssertionFormSchema,
2826
usePhoneAuthNumberFormSchema,
2927
usePhoneAuthVerifyFormSchema,
3028
useRecaptchaVerifier,
@@ -712,116 +710,6 @@ describe("usePhoneAuthVerifyFormSchema", () => {
712710
});
713711
});
714712

715-
describe("useMultiFactorPhoneAuthAssertionFormSchema", () => {
716-
beforeEach(() => {
717-
vi.clearAllMocks();
718-
cleanup();
719-
});
720-
721-
it("returns schema with default English error messages", () => {
722-
const mockUI = createMockUI();
723-
724-
const { result } = renderHook(() => useMultiFactorPhoneAuthAssertionFormSchema(), {
725-
wrapper: ({ children }) => createFirebaseUIProvider({ children, ui: mockUI }),
726-
});
727-
728-
const schema = result.current;
729-
730-
const phoneResult = schema.safeParse({ phoneNumber: "invalid-phone" });
731-
expect(phoneResult.success).toBe(false);
732-
if (!phoneResult.success) {
733-
expect(phoneResult.error.issues[0]!.message).toBe(enUs.translations.errors!.invalidPhoneNumber);
734-
}
735-
});
736-
737-
it("returns schema with custom error messages when locale changes", () => {
738-
const customTranslations = {
739-
errors: {
740-
invalidPhoneNumber: "Por favor ingresa un número de teléfono válido",
741-
},
742-
};
743-
744-
const customLocale = registerLocale("es-ES", customTranslations);
745-
const mockUI = createMockUI({ locale: customLocale });
746-
747-
const { result } = renderHook(() => useMultiFactorPhoneAuthAssertionFormSchema(), {
748-
wrapper: ({ children }) => createFirebaseUIProvider({ children, ui: mockUI }),
749-
});
750-
751-
const schema = result.current;
752-
753-
const phoneResult = schema.safeParse({ phoneNumber: "invalid-phone" });
754-
expect(phoneResult.success).toBe(false);
755-
if (!phoneResult.success) {
756-
expect(phoneResult.error.issues[0]!.message).toBe("Por favor ingresa un número de teléfono válido");
757-
}
758-
});
759-
760-
it("returns stable reference when UI hasn't changed", () => {
761-
const mockUI = createMockUI();
762-
763-
const { result, rerender } = renderHook(() => useMultiFactorPhoneAuthAssertionFormSchema(), {
764-
wrapper: ({ children }) => createFirebaseUIProvider({ children, ui: mockUI }),
765-
});
766-
767-
const initialSchema = result.current;
768-
769-
rerender();
770-
771-
expect(result.current).toBe(initialSchema);
772-
});
773-
774-
it("returns new schema when locale changes", () => {
775-
const mockUI = createMockUI();
776-
777-
const { result, rerender } = renderHook(() => useMultiFactorPhoneAuthAssertionFormSchema(), {
778-
wrapper: ({ children }) => createFirebaseUIProvider({ children, ui: mockUI }),
779-
});
780-
781-
const initialSchema = result.current;
782-
783-
const customTranslations = {
784-
errors: {
785-
invalidPhoneNumber: "Custom phone error",
786-
},
787-
};
788-
const customLocale = registerLocale("fr-FR", customTranslations);
789-
790-
act(() => {
791-
mockUI.get().setLocale(customLocale);
792-
});
793-
794-
rerender();
795-
796-
expect(result.current).not.toBe(initialSchema);
797-
798-
const phoneResult = result.current.safeParse({ phoneNumber: "invalid-phone" });
799-
expect(phoneResult.success).toBe(false);
800-
801-
if (!phoneResult.success) {
802-
expect(phoneResult.error.issues[0]!.message).toBe("Custom phone error");
803-
}
804-
});
805-
806-
it("accepts valid phone number without requiring displayName", () => {
807-
const mockUI = createMockUI();
808-
809-
const { result } = renderHook(() => useMultiFactorPhoneAuthAssertionFormSchema(), {
810-
wrapper: ({ children }) => createFirebaseUIProvider({ children, ui: mockUI }),
811-
});
812-
813-
const schema = result.current;
814-
815-
const phoneResult = schema.safeParse({ phoneNumber: "1234567890" });
816-
expect(phoneResult.success).toBe(true);
817-
if (phoneResult.success) {
818-
expect(phoneResult.data).toEqual({ phoneNumber: "1234567890" });
819-
// Should not have displayName field
820-
expect(phoneResult.data).not.toHaveProperty("displayName");
821-
}
822-
});
823-
});
824-
825713
describe("useRedirectError", () => {
826714
beforeEach(() => {
827715
vi.clearAllMocks();

packages/react/src/hooks.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
createEmailLinkAuthFormSchema,
2121
createForgotPasswordAuthFormSchema,
2222
createMultiFactorPhoneAuthNumberFormSchema,
23-
createMultiFactorPhoneAuthAssertionFormSchema,
2423
createMultiFactorPhoneAuthVerifyFormSchema,
2524
createMultiFactorTotpAuthNumberFormSchema,
2625
createMultiFactorTotpAuthVerifyFormSchema,
@@ -100,11 +99,6 @@ export function useMultiFactorPhoneAuthNumberFormSchema() {
10099
return useMemo(() => createMultiFactorPhoneAuthNumberFormSchema(ui), [ui]);
101100
}
102101

103-
export function useMultiFactorPhoneAuthAssertionFormSchema() {
104-
const ui = useUI();
105-
return useMemo(() => createMultiFactorPhoneAuthAssertionFormSchema(ui), [ui]);
106-
}
107-
108102
export function useMultiFactorPhoneAuthVerifyFormSchema() {
109103
const ui = useUI();
110104
return useMemo(() => createMultiFactorPhoneAuthVerifyFormSchema(ui), [ui]);

0 commit comments

Comments
 (0)