Remove obsolete tests and unused imports in organization members and management components

- Deleted `OrganizationMembersPage` tests as they are no longer relevant.
- Removed unused `updated_at` property from test data in multiple components.
- Cleaned up redundant `useAuth` imports from `OrganizationMembersContent` and `OrganizationManagementContent`.
This commit is contained in:
Felipe Cardoso
2025-11-07 07:55:05 +01:00
parent 6b556431d3
commit 652fb6b180
6 changed files with 0 additions and 78 deletions

View File

@@ -9,7 +9,6 @@ import { useState, useCallback } from 'react';
import { useSearchParams, useRouter } from 'next/navigation';
import { Plus } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { useAuth } from '@/lib/auth/AuthContext';
import {
useAdminOrganizations,
type Organization,

View File

@@ -9,7 +9,6 @@ import { useState, useCallback } from 'react';
import { useSearchParams, useRouter } from 'next/navigation';
import { UserPlus } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { useAuth } from '@/lib/auth/AuthContext';
import {
useOrganizationMembers,
useGetOrganization,

View File

@@ -1,72 +0,0 @@
/**
* Tests for Organization Members Page
*/
import React from 'react';
import { render, screen } from '@testing-library/react';
import OrganizationMembersPage from '@/app/admin/organizations/[id]/members/page';
// Mock Next.js navigation
jest.mock('next/navigation', () => ({
useSearchParams: jest.fn(() => new URLSearchParams()),
useRouter: jest.fn(() => ({
push: jest.fn(),
replace: jest.fn(),
})),
}));
// Mock AuthContext
jest.mock('@/lib/auth/AuthContext', () => ({
useAuth: jest.fn(() => ({
user: { id: '1', email: 'admin@test.com', is_superuser: true },
})),
}));
// Mock hooks
jest.mock('@/lib/api/hooks/useAdmin', () => ({
useOrganizationMembers: jest.fn(() => ({
data: { data: [], pagination: { total: 0, page: 1, page_size: 20, total_pages: 1, has_next: false, has_prev: false } },
isLoading: false,
})),
useGetOrganization: jest.fn(() => ({
data: { id: 'org-1', name: 'Test Org', slug: 'test-org', description: '', is_active: true, created_at: '2025-01-01', updated_at: '2025-01-01', member_count: 0 },
isLoading: false,
})),
}));
// Mock child components
jest.mock('@/components/admin/organizations/OrganizationMembersContent', () => ({
OrganizationMembersContent: ({ organizationId }: any) => (
<div data-testid="organization-members-content">Organization Members Content for {organizationId}</div>
),
}));
describe('OrganizationMembersPage', () => {
const mockParams = { id: 'org-123' };
it('renders organization members page', () => {
render(<OrganizationMembersPage params={mockParams} />);
expect(screen.getByTestId('organization-members-content')).toBeInTheDocument();
});
it('passes organization ID to content component', () => {
render(<OrganizationMembersPage params={mockParams} />);
expect(screen.getByText(/org-123/)).toBeInTheDocument();
});
it('renders back button link', () => {
const { container } = render(<OrganizationMembersPage params={mockParams} />);
const backLink = container.querySelector('a[href="/admin/organizations"]');
expect(backLink).toBeInTheDocument();
});
it('renders container with proper spacing', () => {
const { container } = render(<OrganizationMembersPage params={mockParams} />);
const mainContainer = container.querySelector('.container');
expect(mainContainer).toBeInTheDocument();
});
});

View File

@@ -35,7 +35,6 @@ describe('OrganizationActionMenu', () => {
description: 'Leading provider',
is_active: true,
created_at: '2025-01-01T00:00:00Z',
updated_at: '2025-01-01T00:00:00Z',
member_count: 10,
};

View File

@@ -42,7 +42,6 @@ describe('OrganizationFormDialog', () => {
description: 'Test description',
is_active: true,
created_at: '2025-01-01',
updated_at: '2025-01-01',
member_count: 5,
};

View File

@@ -25,7 +25,6 @@ describe('OrganizationListTable', () => {
description: 'Leading provider of innovative solutions',
is_active: true,
created_at: '2025-01-01T00:00:00Z',
updated_at: '2025-01-01T00:00:00Z',
member_count: 15,
},
{
@@ -34,7 +33,6 @@ describe('OrganizationListTable', () => {
description: null,
is_active: false,
created_at: '2025-01-15T00:00:00Z',
updated_at: '2025-01-15T00:00:00Z',
member_count: 3,
},
];