-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
13 changed files
with
358 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
Oops, something went wrong.