Skip to content

Commit

Permalink
Edit Movies Upcoming
Browse files Browse the repository at this point in the history
Added Edit Movies Upcoming
  • Loading branch information
dtkiriella committed Jan 7, 2024
1 parent 6766f77 commit a47610f
Show file tree
Hide file tree
Showing 13 changed files with 358 additions and 101 deletions.
34 changes: 34 additions & 0 deletions client/component.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { render, screen, describe, test, expect } from '@testing-library/react';
import Navbar from './Navbar';
import Footer from './Footer';
import Admin from './Admin';
import Register from './Register';
import Login from './Login';

describe('Component Tests', () => {
test('renders Navbar component', () => {
render(<Navbar />);
expect(screen.getByText('Navbar Text')).toBeInTheDocument();
});

test('renders Footer component', () => {
render(<Footer />);
expect(screen.getByText('Footer Text')).toBeInTheDocument();
});

test('renders Admin component', () => {
render(<Admin />);
expect(screen.getByText('Admin Text')).toBeInTheDocument();
});

test('renders Register component', () => {
render(<Register />);
expect(screen.getByText('Register Text')).toBeInTheDocument();
});

test('renders Login component', () => {
render(<Login />);
expect(screen.getByText('Login Text')).toBeInTheDocument();
});

});
32 changes: 32 additions & 0 deletions client/form.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { render, fireEvent, waitFor, describe, test, expect } from '@testing-library/react';
import LoginForm from '../LoginForm';
import RegistrationForm from '../RegistrationForm';

describe('Form Tests', () => {
test('Login form can be filled out', async () => {
const { getByLabelText, getByRole } = render(<LoginForm />);

fireEvent.change(getByLabelText(/username/i), { target: { value: 'testuser' } });
fireEvent.change(getByLabelText(/password/i), { target: { value: 'testpass' } });

fireEvent.click(getByRole('button'));

await waitFor(() => expect(getByLabelText(/username/i).value).toBe('testuser'));
await waitFor(() => expect(getByLabelText(/password/i).value).toBe('testpass'));
});

test('Registration form can be filled out', async () => {
const { getByLabelText, getByRole } = render(<RegistrationForm />);

fireEvent.change(getByLabelText(/username/i), { target: { value: 'testuser' } });
fireEvent.change(getByLabelText(/password/i), { target: { value: 'testpass' } });
fireEvent.change(getByLabelText(/confirm password/i), { target: { value: 'testpass' } });

fireEvent.click(getByRole('button'));

await waitFor(() => expect(getByLabelText(/username/i).value).toBe('testuser'));
await waitFor(() => expect(getByLabelText(/password/i).value).toBe('testpass'));
await waitFor(() => expect(getByLabelText(/confirm password/i).value).toBe('testpass'));
});

});
33 changes: 33 additions & 0 deletions client/pages.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { render, screen, describe, test, expect } from '@testing-library/react';
import Admin from './Admin';
import SeatBooking from './SeatBooking';
import Profile from './Profile';
import About from './About';
import Contact from './Contact';

describe('Page Tests', () => {
test('renders Admin page', () => {
render(<Admin />);
expect(screen.getByText('Admin Text')).toBeInTheDocument();
});

test('renders SeatBooking page', () => {
render(<SeatBooking />);
expect(screen.getByText('SeatBooking Text')).toBeInTheDocument();
});

test('renders Profile page', () => {
render(<Profile />);
expect(screen.getByText('Profile Text')).toBeInTheDocument();
});

test('renders About page', () => {
render(<About />);
expect(screen.getByText('About Text')).toBeInTheDocument();
});

test('renders Contact page', () => {
render(<Contact />);
expect(screen.getByText('Contact Text')).toBeInTheDocument();
});
});
25 changes: 25 additions & 0 deletions client/route.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { render, screen, describe, expect, test } from '@testing-library/react';
import { MemoryRouter } from 'react-router-dom';
import App from '../App';

describe('Route Tests', () => {
test('renders Home component when / route is visited', () => {
render(<MemoryRouter initialEntries={['/']}><App /></MemoryRouter>);
expect(screen.getByText('Home Text')).toBeInTheDocument();
});

test('renders About component when /about route is visited', () => {
render(<MemoryRouter initialEntries={['/about']}><App /></MemoryRouter>);
expect(screen.getByText('About Text')).toBeInTheDocument();
});

test('renders Admin_Dashboard component when / route is visited', () => {
render(<MemoryRouter initialEntries={['/']}><App /></MemoryRouter>);
expect(screen.getByText('Admin Dashboard Text')).toBeInTheDocument();
});

test('renders Admin_Premiere component when /premiere route is visited', () => {
render(<MemoryRouter initialEntries={['/premiere']}><App /></MemoryRouter>);
expect(screen.getByText('Admin Premiere Text')).toBeInTheDocument();
});
});
2 changes: 1 addition & 1 deletion client/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Admin from "./Routes/Admin";

function App() {
const shouldHideNavAndFooter = () => {
const hiddenRoutes = ['/admin', '/premiere', '/upcoming', 'logout', '/adminlogin', '/add_premiere_movie', '/add_upcoming_movie', '/edit_premiere']; // Add more routes if needed
const hiddenRoutes = ['/admin', '/premiere', '/upcoming', 'logout', '/adminlogin', '/add_premiere_movie', '/add_upcoming_movie', '/edit_premiere', '/edit_upcoming']; // Add more routes if needed
return hiddenRoutes.includes(window.location.pathname);
};

Expand Down
2 changes: 2 additions & 0 deletions client/src/Routes/Admin.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Admin_Logout from "../pages/Admin/Admin_Logout";
import Premiere_Movie_Add from "/src/components/Admin-Premiere-Movie-Add/Premiere_Movie_Add";
import Upcoming_Movie_Add from "/src/components/Admin-Upcoming-Movie-Add/Upcoming_Movie_Add";
import Admin_Edit_Premiere from "/src/pages/Admin/Admin_Edit_PremiereMovies";
import Admin_Edit_Upcoming from "/src/pages/Admin/Admin_Edit_UpcomingMovies";

function Admin() {
return (
Expand All @@ -22,6 +23,7 @@ function Admin() {
<Route path="/add_premiere_movie" element={<Premiere_Movie_Add/>} />
<Route path="/add_upcoming_movie" element={<Upcoming_Movie_Add/>} />
<Route path="/edit_premiere" element={<Admin_Edit_Premiere/>} />
<Route path="/edit_upcoming" element={<Admin_Edit_Upcoming/>} />



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function MenuItem({ title, image }) {
<p>Yesterday</p>
</div>
<div className="Edit-Delete-Right">
<Link>
<Link to = "/edit_upcoming">
<FaEdit />
</Link>
<Link>
Expand Down
74 changes: 16 additions & 58 deletions client/src/helpers/Admin_Booking_Data.jsx
Original file line number Diff line number Diff line change
@@ -1,74 +1,32 @@
const Admin_Booking_Data = [
{
user: "u_name01",
movie: "Avatar",
user: "Amith",
movie: "Wonka",
date: "2024-01-01",
time: "08.00pm",
seats: "12,13,14",
},
{
user: "u_name02",
movie: "Batman",
date: "2024-02-01",
time: "05.00pm",
seats: "1,2",
},
{
user: "u_name03",
movie: "Avatar",
date: "2024-01-01",
time: "08.00pm",
seats: "18,19",
},
{
user: "u_name04",
movie: "Avatar",
user: "Dushan",
movie: "Leo",
date: "2024-01-01",
time: "08.00pm",
seats: "30,31",
},
{
user: "u_name05",
movie: "Avatar",
date: "2024-01-01",
time: "08.00pm",
seats: "24,25",
},
{
user: "u_name06",
movie: "Avatar",
date: "2024-01-01",
time: "08.00pm",
seats: "7,8",
},
{
user: "u_name07",
movie: "Avatar",
date: "2024-01-01",
time: "08.00pm",
seats: "5",
},
{
user: "u_name08",
movie: "Avatar",
date: "2024-01-01",
time: "08.00pm",
seats: "13",
},
{
user: "u_name09",
movie: "Avatar",
date: "2024-01-01",
time: "08.00pm",
seats: "9,10,11,12,15",
user: "Ashan",
movie: "Kathuru Mithuru",
date: "2024-02-01",
time: "05.00pm",
seats: "1,2",
},
{
user: "u_name10",
movie: "Avatar",
date: "2024-01-01",
time: "08.00pm",
seats: "20,21",
},
user: "Dushan",
movie: "Pathaan",
date: "2024-07-01",
time: "05.00pm",
seats: "18,19",
}
];

export default Admin_Booking_Data;
export default Admin_Booking_Data;
Loading

0 comments on commit a47610f

Please sign in to comment.