refactor: use a better name for the team management view

This commit is contained in:
Diana Olarte
2025-09-25 13:41:41 +10:00
committed by Adolfo R. Brandes
parent aefa9b0feb
commit c73ff150bc
6 changed files with 18 additions and 13 deletions

View File

@@ -4,7 +4,7 @@ import { MemoryRouter } from 'react-router-dom';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import AuthZModule from './index';
jest.mock('./libraries-manager/LibrariesAuthZManager', () => {
jest.mock('./libraries-manager/LibrariesTeamManager', () => {
return lazy(() =>
new Promise<{ default: ComponentType<any> }>(resolve =>
setTimeout(() => resolve({ default: () => <div data-testid="libraries-manager">Loaded</div> }), 100)
@@ -22,7 +22,7 @@ const createTestQueryClient = () =>
});
describe('AuthZModule', () => {
it('renders LoadingPage then LibrariesAuthZManager when route matches', async () => {
it('renders LoadingPage then LibrariesTeamManager when route matches', async () => {
const queryClient = createTestQueryClient();
const path = '/libraries/lib:123';

View File

@@ -2,7 +2,7 @@ import { Suspense } from 'react';
import { Routes, Route } from 'react-router-dom';
import { ErrorBoundary } from '@edx/frontend-platform/react';
import LoadingPage from '@src/components/LoadingPage';
import LibrariesAuthZManager from './libraries-manager/LibrariesAuthZManager';
import { LibrariesTeamManager } from './libraries-manager/';
import { ROUTES } from './constants';
import './index.scss';
@@ -11,7 +11,7 @@ const AuthZModule = () => (
<ErrorBoundary>
<Suspense fallback={<LoadingPage />}>
<Routes>
<Route path={ROUTES.LIBRARIES_TEAM_PATH} element={<LibrariesAuthZManager />} />
<Route path={ROUTES.LIBRARIES_TEAM_PATH} element={<LibrariesTeamManager />} />
</Routes>
</Suspense>
</ErrorBoundary>

View File

@@ -1,5 +1,5 @@
import { screen } from '@testing-library/react';
import LibrariesAuthZManager from './LibrariesAuthZManager';
import LibrariesTeamManager from './LibrariesTeamManager';
import { useLibraryAuthZ } from './context';
import { renderWrapper } from '@src/setupTest';
import { initializeMockApp } from '@edx/frontend-platform/testing';
@@ -19,7 +19,7 @@ jest.mock('./components/TeamTable', () => ({
default: () => <div data-testid="team-table">MockTeamTable</div>,
}));
describe('LibrariesAuthZManager', () => {
describe('LibrariesTeamManager', () => {
beforeEach(() => {
initializeMockApp({
authenticatedUser: {
@@ -38,7 +38,7 @@ describe('LibrariesAuthZManager', () => {
});
it('renders tabs and layout content correctly', () => {
renderWrapper(<div>hola<LibrariesAuthZManager /></div>);
renderWrapper(<LibrariesTeamManager />);
// Tabs
expect(screen.getByRole('tab', { name: /Team Members/i })).toBeInTheDocument();

View File

@@ -6,7 +6,7 @@ import { LibraryAuthZProvider, useLibraryAuthZ } from './context';
import messages from './messages';
const LibrariesAuthZView = () => {
const LibrariesAuthZTeamView = () => {
const intl = useIntl();
const { libraryId, libraryName, libraryOrg } = useLibraryAuthZ();
const rootBradecrumb = intl.formatMessage(messages['library.authz.breadcrumb.root']) || '';
@@ -40,10 +40,10 @@ const LibrariesAuthZView = () => {
</div>
);
};
const LibrariesAuthZManager = () => (
const LibrariesTeamManager = () => (
<LibraryAuthZProvider>
<LibrariesAuthZView />
<LibrariesAuthZTeamView />
</LibraryAuthZProvider>
);
export default LibrariesAuthZManager;
export default LibrariesTeamManager;

View File

@@ -25,10 +25,10 @@ export const useTeamMembers = (libraryId: string) => useQuery<TeamMember[], Erro
* @param libraryId - The unique ID of the library.
*
* @example
* const { data, isLoading, isError } = useLibrary('lib:123',);
* const { data } = useLibrary('lib:123',);
*
*/
export function useLibrary(libraryId: string) {
export const useLibrary = (libraryId: string) => {
return useSuspenseQuery<LibraryMetadata, Error>({
queryKey: ['library-metadata', libraryId],
queryFn: () => getLibrary(libraryId),

View File

@@ -0,0 +1,5 @@
import LibrariesTeamManager from "./LibrariesTeamManager";
export {
LibrariesTeamManager,
}