Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions packages/react/src/auth/oauth/oauth-button.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,13 @@ describe("useSignInWithProvider", () => {
// First call fails, second call succeeds
mockSignInWithProvider
.mockRejectedValueOnce(
new FirebaseUIError(ui.get(), new FirebaseError("auth/wrong-password", "Incorrect password"))
new FirebaseUIError(
ui.get(),
new FirebaseError(
"auth/wrong-password",
"Incorrect email or password. If you previously signed in using another provider, try using that sign-in method instead."
)
)
Comment thread
kevinfernandes-hub marked this conversation as resolved.
)
.mockResolvedValueOnce({} as UserCredential);

Expand All @@ -444,7 +450,9 @@ describe("useSignInWithProvider", () => {
await result.current.callback();
});

expect(result.current.error).toBe("Incorrect password");
expect(result.current.error).toBe(
"Incorrect email or password. If you previously signed in using another provider, try using that sign-in method instead."
);
Comment thread
kevinfernandes-hub marked this conversation as resolved.

// Second call - should clear error
await act(async () => {
Expand Down
18 changes: 15 additions & 3 deletions packages/shadcn/src/components/oauth-button.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,13 @@ describe("<OAuthButton />", () => {
// First call fails, second call succeeds
mockSignInWithProvider
.mockRejectedValueOnce(
new FirebaseUIError(ui.get(), new FirebaseError("auth/wrong-password", "Incorrect password"))
new FirebaseUIError(
ui.get(),
new FirebaseError(
"auth/wrong-password",
"Incorrect email or password. If you previously signed in using another provider, try using that sign-in method instead."
)
)
)
Comment thread
kevinfernandes-hub marked this conversation as resolved.
.mockResolvedValueOnce({} as UserCredential);

Expand All @@ -284,14 +290,20 @@ describe("<OAuthButton />", () => {
fireEvent.click(button);

await waitFor(() => {
const errorMessage = screen.getByText("Incorrect password");
const errorMessage = screen.getByText(
"Incorrect email or password. If you previously signed in using another provider, try using that sign-in method instead."
);
expect(errorMessage).toBeDefined();
});

// Second click - should clear error
fireEvent.click(button);
await waitFor(() => {
expect(screen.queryByText("Incorrect password")).toBeNull();
expect(
screen.queryByText(
"Incorrect email or password. If you previously signed in using another provider, try using that sign-in method instead."
)
).toBeNull();
});
});

Expand Down
4 changes: 3 additions & 1 deletion packages/translations/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,9 @@ describe("index.ts", () => {
it("should have valid error translations", () => {
const errors = enUs.translations.errors;
expect(errors?.userNotFound).toBe("No account found with this email address");
expect(errors?.wrongPassword).toBe("Incorrect password");
expect(errors?.wrongPassword).toBe(
"Incorrect email or password. If you previously signed in using another provider, try using that sign-in method instead."
);
expect(errors?.invalidEmail).toBe("Please enter a valid email address");
expect(errors?.unknownError).toBe("An unexpected error occurred");
});
Expand Down
3 changes: 2 additions & 1 deletion packages/translations/src/locales/en-gb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import { type Translations } from "../types";
export const enGB = {
errors: {
userNotFound: "No account found with this email address",
wrongPassword: "Incorrect password",
wrongPassword:
"Incorrect email or password. If you previously signed in using another provider, try using that sign-in method instead.",
invalidEmail: "Please enter a valid email address",
userDisabled: "This account has been disabled",
networkRequestFailed: "Unable to connect to the server. Please check your internet connection",
Expand Down
3 changes: 2 additions & 1 deletion packages/translations/src/locales/en-us.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import { type Translations } from "../types";
export const enUS = {
errors: {
userNotFound: "No account found with this email address",
wrongPassword: "Incorrect password",
wrongPassword:
"Incorrect email or password. If you previously signed in using another provider, try using that sign-in method instead.",
invalidEmail: "Please enter a valid email address",
userDisabled: "This account has been disabled",
networkRequestFailed: "Unable to connect to the server. Please check your internet connection",
Expand Down
4 changes: 3 additions & 1 deletion packages/translations/src/mapping.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ describe("mapping.ts", () => {
expect(getTranslation(locale, "errors", "userNotFound")).toBe("Custom error message");

// Should fall back to English when not available
expect(getTranslation(locale, "errors", "wrongPassword")).toBe("Incorrect password");
expect(getTranslation(locale, "errors", "wrongPassword")).toBe(
"Incorrect email or password. If you previously signed in using another provider, try using that sign-in method instead."
);
Comment thread
kevinfernandes-hub marked this conversation as resolved.
expect(getTranslation(locale, "labels", "emailAddress")).toBe("Email Address");
});

Expand Down
2 changes: 1 addition & 1 deletion packages/translations/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export type Translations = {
errors?: {
/** Translation for when a user is not found. */
userNotFound?: string;
/** Translation for incorrect password. */
/** Translation for incorrect password or OAuth accounts. */
wrongPassword?: string;
/** Translation for invalid email address. */
invalidEmail?: string;
Expand Down