From 1d7d5a9d01587f9a9497bb26d9cbce2f6862d628 Mon Sep 17 00:00:00 2001 From: Jason Woltje Date: Mon, 16 Feb 2026 11:48:15 -0600 Subject: [PATCH] refactor(#416): delete old LoginButton, replaced by OAuthButton LoginButton.tsx and LoginButton.test.tsx removed. The login page now uses OAuthButton, LoginForm, and AuthDivider from the auth redesign. Refs #416 Co-Authored-By: Claude Opus 4.6 --- .../src/components/auth/LoginButton.test.tsx | 45 ------------------- apps/web/src/components/auth/LoginButton.tsx | 18 -------- 2 files changed, 63 deletions(-) delete mode 100644 apps/web/src/components/auth/LoginButton.test.tsx delete mode 100644 apps/web/src/components/auth/LoginButton.tsx diff --git a/apps/web/src/components/auth/LoginButton.test.tsx b/apps/web/src/components/auth/LoginButton.test.tsx deleted file mode 100644 index d36fe7c..0000000 --- a/apps/web/src/components/auth/LoginButton.test.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import { describe, it, expect, vi, beforeEach } from "vitest"; -import { render, screen } from "@testing-library/react"; -import userEvent from "@testing-library/user-event"; -import { LoginButton } from "./LoginButton"; - -const { mockOAuth2 } = vi.hoisted(() => ({ - mockOAuth2: vi.fn(), -})); - -vi.mock("@/lib/auth-client", () => ({ - signIn: { - oauth2: mockOAuth2, - }, -})); - -describe("LoginButton", (): void => { - beforeEach((): void => { - mockOAuth2.mockClear(); - }); - - it("should render sign in button", (): void => { - render(); - const button = screen.getByRole("button", { name: /sign in/i }); - expect(button).toBeInTheDocument(); - }); - - it("should initiate OAuth2 sign-in on click", async (): Promise => { - const user = userEvent.setup(); - render(); - - const button = screen.getByRole("button", { name: /sign in/i }); - await user.click(button); - - expect(mockOAuth2).toHaveBeenCalledWith({ - providerId: "authentik", - callbackURL: "/", - }); - }); - - it("should have proper styling", (): void => { - render(); - const button = screen.getByRole("button", { name: /sign in/i }); - expect(button).toHaveClass("w-full"); - }); -}); diff --git a/apps/web/src/components/auth/LoginButton.tsx b/apps/web/src/components/auth/LoginButton.tsx deleted file mode 100644 index bc8c5dd..0000000 --- a/apps/web/src/components/auth/LoginButton.tsx +++ /dev/null @@ -1,18 +0,0 @@ -"use client"; - -import { Button } from "@mosaic/ui"; -import { signIn } from "@/lib/auth-client"; - -export function LoginButton(): React.JSX.Element { - const handleLogin = (): void => { - // Use BetterAuth's genericOAuth client to initiate the OIDC flow. - // This POSTs to /auth/sign-in/oauth2 and follows the returned redirect URL. - void signIn.oauth2({ providerId: "authentik", callbackURL: "/" }); - }; - - return ( - - ); -}