Skip to content

Commit 39686a0

Browse files
committed
refactor: use a better name for the team management view
1 parent a6f96e3 commit 39686a0

6 files changed

Lines changed: 18 additions & 13 deletions

File tree

src/authz-module/index.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { MemoryRouter } from 'react-router-dom';
44
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
55
import AuthZModule from './index';
66

7-
jest.mock('./libraries-manager/LibrariesAuthZManager', () => {
7+
jest.mock('./libraries-manager/LibrariesTeamManager', () => {
88
return lazy(() =>
99
new Promise<{ default: ComponentType<any> }>(resolve =>
1010
setTimeout(() => resolve({ default: () => <div data-testid="libraries-manager">Loaded</div> }), 100)
@@ -22,7 +22,7 @@ const createTestQueryClient = () =>
2222
});
2323

2424
describe('AuthZModule', () => {
25-
it('renders LoadingPage then LibrariesAuthZManager when route matches', async () => {
25+
it('renders LoadingPage then LibrariesTeamManager when route matches', async () => {
2626
const queryClient = createTestQueryClient();
2727
const path = '/libraries/lib:123';
2828

src/authz-module/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Suspense } from 'react';
22
import { Routes, Route } from 'react-router-dom';
33
import { ErrorBoundary } from '@edx/frontend-platform/react';
44
import LoadingPage from '@src/components/LoadingPage';
5-
import LibrariesAuthZManager from './libraries-manager/LibrariesAuthZManager';
5+
import { LibrariesTeamManager } from './libraries-manager/';
66
import { ROUTES } from './constants';
77

88
import './index.scss';
@@ -11,7 +11,7 @@ const AuthZModule = () => (
1111
<ErrorBoundary>
1212
<Suspense fallback={<LoadingPage />}>
1313
<Routes>
14-
<Route path={ROUTES.LIBRARIES_TEAM_PATH} element={<LibrariesAuthZManager />} />
14+
<Route path={ROUTES.LIBRARIES_TEAM_PATH} element={<LibrariesTeamManager />} />
1515
</Routes>
1616
</Suspense>
1717
</ErrorBoundary>

src/authz-module/libraries-manager/LibrariesAuthZManager.test.tsx renamed to src/authz-module/libraries-manager/LibrariesTeamManager.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { screen } from '@testing-library/react';
2-
import LibrariesAuthZManager from './LibrariesAuthZManager';
2+
import LibrariesTeamManager from './LibrariesTeamManager';
33
import { useLibraryAuthZ } from './context';
44
import { renderWrapper } from '@src/setupTest';
55
import { initializeMockApp } from '@edx/frontend-platform/testing';
@@ -19,7 +19,7 @@ jest.mock('./components/TeamTable', () => ({
1919
default: () => <div data-testid="team-table">MockTeamTable</div>,
2020
}));
2121

22-
describe('LibrariesAuthZManager', () => {
22+
describe('LibrariesTeamManager', () => {
2323
beforeEach(() => {
2424
initializeMockApp({
2525
authenticatedUser: {
@@ -38,7 +38,7 @@ describe('LibrariesAuthZManager', () => {
3838
});
3939

4040
it('renders tabs and layout content correctly', () => {
41-
renderWrapper(<div>hola<LibrariesAuthZManager /></div>);
41+
renderWrapper(<LibrariesTeamManager />);
4242

4343
// Tabs
4444
expect(screen.getByRole('tab', { name: /Team Members/i })).toBeInTheDocument();

src/authz-module/libraries-manager/LibrariesAuthZManager.tsx renamed to src/authz-module/libraries-manager/LibrariesTeamManager.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { LibraryAuthZProvider, useLibraryAuthZ } from './context';
66

77
import messages from './messages';
88

9-
const LibrariesAuthZView = () => {
9+
const LibrariesAuthZTeamView = () => {
1010
const intl = useIntl();
1111
const { libraryId, libraryName, libraryOrg } = useLibraryAuthZ();
1212
const rootBradecrumb = intl.formatMessage(messages['library.authz.breadcrumb.root']) || '';
@@ -40,10 +40,10 @@ const LibrariesAuthZView = () => {
4040
</div>
4141
);
4242
};
43-
const LibrariesAuthZManager = () => (
43+
const LibrariesTeamManager = () => (
4444
<LibraryAuthZProvider>
45-
<LibrariesAuthZView />
45+
<LibrariesAuthZTeamView />
4646
</LibraryAuthZProvider>
4747
);
4848

49-
export default LibrariesAuthZManager;
49+
export default LibrariesTeamManager;

src/authz-module/libraries-manager/data/hooks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ export const useTeamMembers = (libraryId: string) => useQuery<TeamMember[], Erro
2525
* @param libraryId - The unique ID of the library.
2626
*
2727
* @example
28-
* const { data, isLoading, isError } = useLibrary('lib:123',);
28+
* const { data } = useLibrary('lib:123',);
2929
*
3030
*/
31-
export function useLibrary(libraryId: string) {
31+
export const useLibrary = (libraryId: string) => {
3232
return useSuspenseQuery<LibraryMetadata, Error>({
3333
queryKey: ['library-metadata', libraryId],
3434
queryFn: () => getLibrary(libraryId),
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import LibrariesTeamManager from "./LibrariesTeamManager";
2+
3+
export {
4+
LibrariesTeamManager,
5+
}

0 commit comments

Comments
 (0)