From cba29e6aae637b04ff6eaf28f74bc15b6242b9ea Mon Sep 17 00:00:00 2001
From: Adam Mathes <adam@adammathes.com>
Date: Mon, 16 Feb 2026 19:37:50 -0800
Subject: Remove legacy V2 React frontend and update build/test scripts to
 focus on Vanilla JS (V3)

---
 frontend/src/components/Login.test.tsx | 93 ----------------------------------
 1 file changed, 93 deletions(-)
 delete mode 100644 frontend/src/components/Login.test.tsx

(limited to 'frontend/src/components/Login.test.tsx')

diff --git a/frontend/src/components/Login.test.tsx b/frontend/src/components/Login.test.tsx
deleted file mode 100644
index 47f37e3..0000000
--- a/frontend/src/components/Login.test.tsx
+++ /dev/null
@@ -1,93 +0,0 @@
-import React from 'react';
-import '@testing-library/jest-dom';
-import { render, screen, fireEvent, waitFor } from '@testing-library/react';
-import { BrowserRouter } from 'react-router-dom';
-import { describe, it, expect, vi, beforeEach } from 'vitest';
-import Login from './Login';
-
-// Mock fetch
-global.fetch = vi.fn();
-
-const renderLogin = () => {
-  render(
-    <BrowserRouter>
-      <Login />
-    </BrowserRouter>
-  );
-};
-
-describe('Login Component', () => {
-  beforeEach(() => {
-    vi.resetAllMocks();
-  });
-
-  it('renders login form', () => {
-    renderLogin();
-    expect(screen.getByLabelText(/username/i)).toBeInTheDocument();
-    expect(screen.getByLabelText(/password/i)).toBeInTheDocument();
-    expect(screen.getByRole('button', { name: /login/i })).toBeInTheDocument();
-  });
-
-  it('handles successful login', async () => {
-    vi.mocked(global.fetch).mockResolvedValueOnce({
-      ok: true,
-    } as Response);
-
-    renderLogin();
-
-    fireEvent.change(screen.getByLabelText(/username/i), { target: { value: 'testuser' } });
-    fireEvent.change(screen.getByLabelText(/password/i), { target: { value: 'secret' } });
-    fireEvent.click(screen.getByRole('button', { name: /login/i }));
-
-    await waitFor(() => {
-      expect(global.fetch).toHaveBeenCalledWith(
-        '/api/login',
-        expect.objectContaining({
-          method: 'POST',
-          body: expect.any(URLSearchParams),
-        })
-      );
-    });
-
-    // Check if params contained username and password
-    const callArgs = vi.mocked(global.fetch).mock.calls[0][1];
-    const body = callArgs?.body as URLSearchParams;
-    expect(body.get('username')).toBe('testuser');
-    expect(body.get('password')).toBe('secret');
-
-    // Navigation assertion is tricky without mocking useNavigate,
-    // but if no error is shown, we assume success path was taken
-    expect(screen.queryByText(/login failed/i)).not.toBeInTheDocument();
-  });
-
-  it('handles failed login', async () => {
-    vi.mocked(global.fetch).mockResolvedValueOnce({
-      ok: false,
-      json: async () => ({ message: 'Bad credentials' }),
-    } as Response);
-
-    renderLogin();
-
-    fireEvent.change(screen.getByLabelText(/username/i), { target: { value: 'testuser' } });
-    fireEvent.change(screen.getByLabelText(/password/i), { target: { value: 'wrong' } });
-    fireEvent.click(screen.getByRole('button', { name: /login/i }));
-
-    await waitFor(() => {
-      expect(screen.getByText(/bad credentials/i)).toBeInTheDocument();
-    });
-  });
-
-  it('handles network error', async () => {
-    vi.mocked(global.fetch).mockRejectedValueOnce(new Error('Network error'));
-
-    renderLogin();
-
-    fireEvent.change(screen.getByLabelText(/username/i), { target: { value: 'testuser' } });
-    fireEvent.change(screen.getByLabelText(/password/i), { target: { value: 'secret' } });
-    fireEvent.click(screen.getByRole('button', { name: /login/i }));
-
-    await waitFor(() => {
-      expect(screen.getByText(/network error/i)).toBeInTheDocument();
-    });
-  });
-});
-- 
cgit v1.2.3

