forked from cardosofelipe/fast-next-template
Add organization members management components and tests
- Implemented `OrganizationMembersContent`, `OrganizationMembersTable`, and `AddMemberDialog` components for organization members management. - Added unit tests for `OrganizationMembersContent` and `OrganizationMembersTable`, covering rendering, state handling, and edge cases. - Enhanced `useOrganizationMembers` and `useGetOrganization` hooks to support members list and pagination data integration. - Updated E2E tests to include organization members page interactions and improved reliability.
This commit is contained in:
@@ -50,6 +50,42 @@ export const MOCK_SUPERUSER = {
|
||||
updated_at: new Date().toISOString(),
|
||||
};
|
||||
|
||||
/**
|
||||
* Mock organization data for E2E testing
|
||||
*/
|
||||
export const MOCK_ORGANIZATIONS = [
|
||||
{
|
||||
id: '00000000-0000-0000-0000-000000000101',
|
||||
name: 'Acme Corporation',
|
||||
slug: 'acme-corporation',
|
||||
description: 'Leading provider of innovative solutions',
|
||||
is_active: true,
|
||||
created_at: new Date('2025-01-01').toISOString(),
|
||||
updated_at: new Date('2025-01-01').toISOString(),
|
||||
member_count: 15,
|
||||
},
|
||||
{
|
||||
id: '00000000-0000-0000-0000-000000000102',
|
||||
name: 'Tech Startup Inc',
|
||||
slug: 'tech-startup-inc',
|
||||
description: 'Building the future of technology',
|
||||
is_active: false,
|
||||
created_at: new Date('2025-01-15').toISOString(),
|
||||
updated_at: new Date('2025-01-15').toISOString(),
|
||||
member_count: 3,
|
||||
},
|
||||
{
|
||||
id: '00000000-0000-0000-0000-000000000103',
|
||||
name: 'Global Enterprises',
|
||||
slug: 'global-enterprises',
|
||||
description: null,
|
||||
is_active: true,
|
||||
created_at: new Date('2025-02-01').toISOString(),
|
||||
updated_at: new Date('2025-02-01').toISOString(),
|
||||
member_count: 42,
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* Authenticate user via REAL login flow
|
||||
* Tests actual user behavior: fill form → submit → API call → store tokens → redirect
|
||||
@@ -262,12 +298,14 @@ export async function setupSuperuserMocks(page: Page): Promise<void> {
|
||||
status: 200,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({
|
||||
data: [],
|
||||
data: MOCK_ORGANIZATIONS,
|
||||
pagination: {
|
||||
total: 0,
|
||||
total: MOCK_ORGANIZATIONS.length,
|
||||
page: 1,
|
||||
page_size: 50,
|
||||
total_pages: 0,
|
||||
total_pages: 1,
|
||||
has_next: false,
|
||||
has_prev: false,
|
||||
},
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user