diff --git a/myEvents.test.tsx b/myEvents.test.tsx
new file mode 100644
index 00000000..198d0517
--- /dev/null
+++ b/myEvents.test.tsx
@@ -0,0 +1,28 @@
+import { render, screen } from '@testing-library/react';
+import MyEvents from '@/app/my-events/page';
+import useAuth from '@/hooks/useAuth';
+import '@testing-library/jest-dom';
+
+jest.mock('@/hooks/useAuth');
+jest.mock('@/components/UnauthorizedPageMessage', () => () =>
Unauthorized
);
+jest.mock('@/components/ViewMyEventsGetter', () => () => My Events List Component
);
+
+describe('MyEvents Page', () => {
+ it('renders UnauthorizedPageMessage if the user is not authorized', () => {
+ (useAuth as jest.Mock).mockReturnValue({ isAuth: false, user: null });
+ render();
+ expect(screen.getByText('Unauthorized')).toBeInTheDocument();
+ });
+
+ it('renders My Created Events title for authorized users', () => {
+ (useAuth as jest.Mock).mockReturnValue({ isAuth: true, user: { role: 'admin' } });
+ render();
+ expect(screen.getByText('My Created Events')).toBeInTheDocument();
+ });
+
+ it('renders MyEventsList component for authorized users', () => {
+ (useAuth as jest.Mock).mockReturnValue({ isAuth: true, user: { role: 'creator' } });
+ render();
+ expect(screen.getByText('My Events List Component')).toBeInTheDocument();
+ });
+});
diff --git a/tests/unit/archivedEvents.test.tsx b/tests/unit/archivedEvents.test.tsx
new file mode 100644
index 00000000..032e067a
--- /dev/null
+++ b/tests/unit/archivedEvents.test.tsx
@@ -0,0 +1,48 @@
+import { render, screen } from '@testing-library/react';
+import ArchivedEvents from '@/app/archived-events/page';
+import useAuth from '@/hooks/useAuth';
+import { useArchivedEvents } from '@/utility/queries';
+import '@testing-library/jest-dom';
+
+jest.mock('@/hooks/useAuth');
+jest.mock('@/utility/queries');
+jest.mock('@/components/UnauthorizedPageMessage', () => () => Unauthorized
);
+
+describe('ArchivedEvents Page', () => {
+ beforeEach(() => {
+ // Mock `useAuth` to simulate an authorized user
+ (useAuth as jest.Mock).mockReturnValue({ isAuth: true, user: { role: 'admin' } });
+
+ // Mock `useArchivedEvents` to return test data
+ (useArchivedEvents as jest.Mock).mockReturnValue({
+ data: [
+ { _id: '1', eventTitle: 'Archived Event 1', eventDate: '2024-11-15' },
+ { _id: '2', eventTitle: 'Archived Event 2', eventDate: '2024-12-01' },
+ ],
+ isLoading: false,
+ isError: false,
+ error: null,
+ refetch: jest.fn(),
+ });
+ });
+
+ it('renders UnauthorizedPageMessage if the user is not authorized', () => {
+ (useAuth as jest.Mock).mockReturnValue({ isAuth: false, user: null });
+ render();
+ expect(screen.getByText('Unauthorized')).toBeInTheDocument();
+ });
+
+ it('renders the list of archived events for authorized users', () => {
+ render();
+ expect(screen.getByText('Archived Events')).toBeInTheDocument();
+ expect(screen.getByText('Archived Event 1')).toBeInTheDocument();
+ expect(screen.getByText('Archived Event 2')).toBeInTheDocument();
+ });
+
+ // Remove or adjust this test if not applicable
+ it('does not render "Load more events" button', () => {
+ render();
+ const loadMoreButton = screen.queryByRole('button', { name: /load more events/i });
+ expect(loadMoreButton).not.toBeInTheDocument();
+ });
+});
diff --git a/tests/unit/myEvents.test.tsx b/tests/unit/myEvents.test.tsx
new file mode 100644
index 00000000..198d0517
--- /dev/null
+++ b/tests/unit/myEvents.test.tsx
@@ -0,0 +1,28 @@
+import { render, screen } from '@testing-library/react';
+import MyEvents from '@/app/my-events/page';
+import useAuth from '@/hooks/useAuth';
+import '@testing-library/jest-dom';
+
+jest.mock('@/hooks/useAuth');
+jest.mock('@/components/UnauthorizedPageMessage', () => () => Unauthorized
);
+jest.mock('@/components/ViewMyEventsGetter', () => () => My Events List Component
);
+
+describe('MyEvents Page', () => {
+ it('renders UnauthorizedPageMessage if the user is not authorized', () => {
+ (useAuth as jest.Mock).mockReturnValue({ isAuth: false, user: null });
+ render();
+ expect(screen.getByText('Unauthorized')).toBeInTheDocument();
+ });
+
+ it('renders My Created Events title for authorized users', () => {
+ (useAuth as jest.Mock).mockReturnValue({ isAuth: true, user: { role: 'admin' } });
+ render();
+ expect(screen.getByText('My Created Events')).toBeInTheDocument();
+ });
+
+ it('renders MyEventsList component for authorized users', () => {
+ (useAuth as jest.Mock).mockReturnValue({ isAuth: true, user: { role: 'creator' } });
+ render();
+ expect(screen.getByText('My Events List Component')).toBeInTheDocument();
+ });
+});