diff --git a/webapp/src/App.css b/webapp/src/App.css deleted file mode 100644 index 74b5e053..00000000 --- a/webapp/src/App.css +++ /dev/null @@ -1,38 +0,0 @@ -.App { - text-align: center; -} - -.App-logo { - height: 40vmin; - pointer-events: none; -} - -@media (prefers-reduced-motion: no-preference) { - .App-logo { - animation: App-logo-spin infinite 20s linear; - } -} - -.App-header { - background-color: #282c34; - min-height: 100vh; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - font-size: calc(10px + 2vmin); - color: white; -} - -.App-link { - color: #61dafb; -} - -@keyframes App-logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} diff --git a/webapp/src/App.js b/webapp/src/App.js deleted file mode 100644 index bb046dad..00000000 --- a/webapp/src/App.js +++ /dev/null @@ -1,38 +0,0 @@ -import React, { useState } from 'react'; -import AddUser from './pages/Register'; -import Login from './pages/Login'; -import CssBaseline from '@mui/material/CssBaseline'; -import Container from '@mui/material/Container'; -import Typography from '@mui/material/Typography'; -import Link from '@mui/material/Link'; - -function App() { - const [showLogin, setShowLogin] = useState(true); - - const handleToggleView = () => { - setShowLogin(!showLogin); - }; - - return ( - - - - Welcome to wiq_en2b - - {showLogin ? : } - - {showLogin ? ( - - Don't have an account? Register here. - - ) : ( - - Already have an account? Login here. - - )} - - - ); -} - -export default App; diff --git a/webapp/src/App.test.js b/webapp/src/App.test.js deleted file mode 100644 index 7534dabd..00000000 --- a/webapp/src/App.test.js +++ /dev/null @@ -1,8 +0,0 @@ -import { render, screen } from '@testing-library/react'; -import App from './App'; - -test('renders learn react link', () => { - render(); - const linkElement = screen.getByText(/Welcome to wiq_en2b/i); - expect(linkElement).toBeInTheDocument(); -}); diff --git a/webapp/src/tests/Login.test.js b/webapp/src/tests/Login.test.js deleted file mode 100644 index 4d662a6c..00000000 --- a/webapp/src/tests/Login.test.js +++ /dev/null @@ -1,62 +0,0 @@ -// import React from 'react'; -// import { render, fireEvent, screen, waitFor, act } from '@testing-library/react'; -// import axios from 'axios'; -// import MockAdapter from 'axios-mock-adapter'; -// import Login from '../pages/Login'; - -// const mockAxios = new MockAdapter(axios); - -// describe('Login component', () => { -// beforeEach(() => { -// mockAxios.reset(); -// }); - -// it('should log in successfully', async () => { -// render(); - -// const usernameInput = screen.getByLabelText(/Username/i); -// const passwordInput = screen.getByLabelText(/Password/i); -// const loginButton = screen.getByRole('button', { name: /Login/i }); - -// // Mock the axios.post request to simulate a successful response -// mockAxios.onPost('http://localhost:8000/login').reply(200, { createdAt: '2024-01-01T12:34:56Z' }); - -// // Simulate user input -// await act(async () => { -// fireEvent.change(usernameInput, { target: { value: 'testUser' } }); -// fireEvent.change(passwordInput, { target: { value: 'testPassword' } }); -// fireEvent.click(loginButton); -// }); - -// // Verify that the user information is displayed -// expect(screen.getByText(/Hello testUser!/i)).toBeInTheDocument(); -// expect(screen.getByText(/Your account was created on 1\/1\/2024/i)).toBeInTheDocument(); -// }); - -// it('should handle error when logging in', async () => { -// render(); - -// const usernameInput = screen.getByLabelText(/Username/i); -// const passwordInput = screen.getByLabelText(/Password/i); -// const loginButton = screen.getByRole('button', { name: /Login/i }); - -// // Mock the axios.post request to simulate an error response -// mockAxios.onPost('http://localhost:8000/login').reply(401, { error: 'Unauthorized' }); - -// // Simulate user input -// fireEvent.change(usernameInput, { target: { value: 'testUser' } }); -// fireEvent.change(passwordInput, { target: { value: 'testPassword' } }); - -// // Trigger the login button click -// fireEvent.click(loginButton); - -// // Wait for the error Snackbar to be open -// await waitFor(() => { -// expect(screen.getByText(/Error: Unauthorized/i)).toBeInTheDocument(); -// }); - -// // Verify that the user information is not displayed -// expect(screen.queryByText(/Hello testUser!/i)).toBeNull(); -// expect(screen.queryByText(/Your account was created on/i)).toBeNull(); -// }); -// }); diff --git a/webapp/src/tests/Register.test.js b/webapp/src/tests/Register.test.js deleted file mode 100644 index 2b2a2e3d..00000000 --- a/webapp/src/tests/Register.test.js +++ /dev/null @@ -1,59 +0,0 @@ -// import React from 'react'; -// import { render, fireEvent, screen, waitFor } from '@testing-library/react'; -// import axios from 'axios'; -// import MockAdapter from 'axios-mock-adapter'; -// // import AddUser from '../pages/Register'; - -// const mockAxios = new MockAdapter(axios); - -// describe('AddUser component', () => { -// beforeEach(() => { -// mockAxios.reset(); -// }); - -// it('should add user successfully', async () => { -// render(); - -// const usernameInput = screen.getByLabelText(/Username/i); -// const passwordInput = screen.getByLabelText(/Password/i); -// const addUserButton = screen.getByRole('button', { name: /Register/i }); - -// // Mock the axios.post request to simulate a successful response -// mockAxios.onPost('http://localhost:8000/adduser').reply(200); - -// // Simulate user input -// fireEvent.change(usernameInput, { target: { value: 'testUser' } }); -// fireEvent.change(passwordInput, { target: { value: 'testPassword' } }); - -// // Trigger the add user button click -// fireEvent.click(addUserButton); - -// // Wait for the Snackbar to be open -// await waitFor(() => { -// expect(screen.getByText(/User added successfully/i)).toBeInTheDocument(); -// }); -// }); - -// it('should handle error when adding user', async () => { -// render(); - -// const usernameInput = screen.getByLabelText(/Username/i); -// const passwordInput = screen.getByLabelText(/Password/i); -// const addUserButton = screen.getByRole('button', { name: /Register/i }); - -// // Mock the axios.post request to simulate an error response -// mockAxios.onPost('http://localhost:8000/adduser').reply(500, { error: 'Internal Server Error' }); - -// // Simulate user input -// fireEvent.change(usernameInput, { target: { value: 'testUser' } }); -// fireEvent.change(passwordInput, { target: { value: 'testPassword' } }); - -// // Trigger the add user button click -// fireEvent.click(addUserButton); - -// // Wait for the error Snackbar to be open -// await waitFor(() => { -// expect(screen.getByText(/Error: Internal Server Error/i)).toBeInTheDocument(); -// }); -// }); -// });