diff --git a/ui/package.json b/ui/package.json index 9a06510b..8f36ac89 100644 --- a/ui/package.json +++ b/ui/package.json @@ -18,7 +18,7 @@ "@fortawesome/react-fontawesome": "^0.2.2", "@hookform/resolvers": "^3.3.4", "@radix-ui/react-alert-dialog": "^1.0.5", - "@radix-ui/react-dialog": "^1.0.5", + "@radix-ui/react-dialog": "^1.1.1", "@radix-ui/react-dropdown-menu": "^2.1.1", "@radix-ui/react-icons": "^1.3.0", "@radix-ui/react-label": "^2.0.2", diff --git a/ui/src/app/admin/page.tsx b/ui/src/app/admin/page.tsx index 5e7a9677..d37d674b 100644 --- a/ui/src/app/admin/page.tsx +++ b/ui/src/app/admin/page.tsx @@ -1,37 +1,54 @@ import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs'; +//TODO: import { getAllGroupings, groupingAdmins } from '@/lib/fetchers'; +import { groupingAdmins, ownerGroupings } from '@/lib/fetchers'; +import GroupingsTable from '@/components/table/groupings-table/groupings-table'; +import AdminTable from '@/components/table/admin-table/admin-table'; + +const Admin = async () => { + //TODO: const { groupingPaths } = await getAllGroupings(); + const { groupingPaths } = await ownerGroupings(); + const { members } = await groupingAdmins(); -const Admin = () => { return ( - -
- - - Manage Groupings - - - Manage Admins - - - Manage Person - - +
+
+ +
+ + + Manage Groupings + + + Manage Admins + + + Manage Person + + +
+ +
+
+ +
+
+
+ +
+
+ + {/**/} +
+
+
+ +
+
{/* PersonTable goes here */}
+
+
+
- -
-
{/* GroupingsTable goes here */}
-
-
- -
-
{/* AdminTable goes here */}
-
-
- -
-
{/* PersonTable goes here */}
-
-
- +
); }; diff --git a/ui/src/app/groupings/[groupingPath]/_components/description-form.tsx b/ui/src/app/groupings/[groupingPath]/_components/description-form.tsx index c9b01974..e46ecdde 100644 --- a/ui/src/app/groupings/[groupingPath]/_components/description-form.tsx +++ b/ui/src/app/groupings/[groupingPath]/_components/description-form.tsx @@ -88,7 +88,10 @@ const DescriptionForm = ({ groupDescription, groupPath }: { groupDescription: st
+ close()}>Cancel + + + + ); +}; + +export default RemoveMemberModal; diff --git a/ui/src/components/table/admin-table/admin-table-skeleton.tsx b/ui/src/components/table/admin-table/admin-table-skeleton.tsx new file mode 100644 index 00000000..69deb1f0 --- /dev/null +++ b/ui/src/components/table/admin-table/admin-table-skeleton.tsx @@ -0,0 +1,48 @@ +import { Skeleton } from '@/components/ui/skeleton'; +import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table'; +import AdminTableColumns from '@/components/table/admin-table/table-element/admin-table-columns'; + +const AdminTableSkeleton = () => { + const pageSize = 7; // Average number of rows + + return ( +
+
+

Manage Admins

+
+ +
+ +
+
+
+ + + + {AdminTableColumns.map((column) => ( + + + + ))} + + + + {Array.from(Array(pageSize), (_, index) => ( + + {AdminTableColumns.map((column) => ( + + + + ))} + + ))} + +
+
+ +
+
+ ); +}; + +export default AdminTableSkeleton; diff --git a/ui/src/components/table/admin-table/admin-table.tsx b/ui/src/components/table/admin-table/admin-table.tsx new file mode 100644 index 00000000..81372700 --- /dev/null +++ b/ui/src/components/table/admin-table/admin-table.tsx @@ -0,0 +1,100 @@ +'use client'; + +import { + useReactTable, + flexRender, + getCoreRowModel, + getPaginationRowModel, + getFilteredRowModel, + getSortedRowModel +} from '@tanstack/react-table'; +import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table'; +import AdminTableColumns from '@/components/table/admin-table/table-element/admin-table-columns'; +import PaginationBar from '@/components/table/table-element/pagination-bar'; +import GlobalFilter from '@/components/table/table-element/global-filter'; +import SortArrow from '@/components/table/table-element/sort-arrow'; +import { useState } from 'react'; +import { MemberResult } from '@/lib/types'; +import dynamic from 'next/dynamic'; +import AdminTableSkeleton from '@/components/table/admin-table/admin-table-skeleton'; +const pageSize = parseInt(process.env.NEXT_PUBLIC_PAGE_SIZE as string); + +const AdminTable = ({ members }: { members: MemberResult[] }) => { + const [globalFilter, setGlobalFilter] = useState(''); + const [sorting, setSorting] = useState([]); + + const table = useReactTable({ + columns: AdminTableColumns, + data: members, + getCoreRowModel: getCoreRowModel(), + getPaginationRowModel: getPaginationRowModel(), + getFilteredRowModel: getFilteredRowModel(), + getSortedRowModel: getSortedRowModel(), + state: { globalFilter, sorting }, + initialState: { pagination: { pageSize } }, + onGlobalFilterChange: setGlobalFilter, + onSortingChange: setSorting, + enableMultiSort: true + }); + + return ( + <> +
+

Manage Admins

+
+ +
+
+ + + {table.getHeaderGroups().map((headerGroup) => ( + + {headerGroup.headers.map((header) => ( + +
+ {flexRender(header.column.columnDef.header, header.getContext())} + +
+
+ ))} +
+ ))} +
+ + {table.getRowModel().rows.map((row) => ( + + {row.getVisibleCells().map((cell) => ( + 0 ? 'hidden sm:table-cell' : ''}`} + > +
+ {flexRender(cell.column.columnDef.cell, cell.getContext())} +
+
+ ))} +
+ ))} +
+
+
+
+ {/*TODO: + TODO: */} +
+
+ +
+
+ + ); +}; + +export default dynamic(() => Promise.resolve(AdminTable), { + ssr: false, // Disable SSR for localStorage + loading: () => +}); diff --git a/ui/src/components/table/admin-table/table-element/add-admin.tsx b/ui/src/components/table/admin-table/table-element/add-admin.tsx new file mode 100644 index 00000000..d6e522cf --- /dev/null +++ b/ui/src/components/table/admin-table/table-element/add-admin.tsx @@ -0,0 +1,50 @@ +import {Input} from '@/components/ui/input' +import {Dispatch, SetStateAction} from 'react'; +import {Button} from '@/components/ui/button'; +import {addAdmin} from '@/actions/groupings-api'; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger +} from '@/components/ui/tooltip'; + +interface InputProps { + input: string; + setInput: Dispatch>; +} + +const handleClick = (input: string) => { + //TODO: create a condition where the admin list is checked for the uhid/uhUuid the user entered in. + //TODO: if it does not exist in the admin list, add the new admin to the UH Groupings admin list. + addAdmin(input); +}; +const AddAdmin = ({input, setInput}: InputProps) => ( + //Add tooltip +
+ setInput(e.target.value)} + /> + + + + + + +

Add to admins

+
+
+
+
+); + +export default AddAdmin; diff --git a/ui/src/components/table/admin-table/table-element/add-admins-dialog.tsx b/ui/src/components/table/admin-table/table-element/add-admins-dialog.tsx new file mode 100644 index 00000000..de7a038b --- /dev/null +++ b/ui/src/components/table/admin-table/table-element/add-admins-dialog.tsx @@ -0,0 +1,112 @@ +import { + AlertDialog, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, + AlertDialogTrigger +} from '@/components/ui/alert-dialog'; +import { Button } from '@/components/ui/button'; +import { Input } from '@/components/ui/input'; +import { Dispatch, SetStateAction } from 'react'; +import { Alert, AlertDescription } from '@/components/ui/alert'; +import { Label } from '@/components/ui/label'; +import { MemberResult } from '@/lib/types'; +import { addAdmin } from '@/lib/actions'; + +interface InputProps { + input: string; + setInput: Dispatch>; +} + +const AddAdminsDialog = ({ input, setInput }: InputProps, { uid, name, uhUuid }: MemberResult) => { + return ( +
+ setInput(e.target.value)} + /> + + + + + + + Add Member + + You are about to add the following member to the admins list. + + +
+
+
+ +
+
+ +
+
+ +
+
+ + {/*second column*/} + +
+
+ +
+
+ +
+
+ +
+
+
+ + Are you sure you want to add{' '} + + {name} + {' '} + to the admins list? + +
+ + + Membership changes made may not take effect immediately. Usually, 3-5 minutes should be + anticipated. In extreme cases changes may take several hours to be fully processed, + depending on the number of members and the synchronization destination. + + +
+ + + close()}>Cancel + +
+
+
+ ); +}; + +export default AddAdminsDialog; diff --git a/ui/src/components/table/admin-table/table-element/admin-table-columns.tsx b/ui/src/components/table/admin-table/table-element/admin-table-columns.tsx new file mode 100644 index 00000000..aa711f79 --- /dev/null +++ b/ui/src/components/table/admin-table/table-element/admin-table-columns.tsx @@ -0,0 +1,35 @@ +import RemoveMemberModal from '@/components/modal/remove-member-modal'; +import { removeAdmin } from '@/lib/actions'; + +const AdminTableColumns = [ + { + header: 'Admin Name', + accessorKey: 'name', + sortDescFirst: true, + cell: ({ row }) =>
{row.getValue('name')}
+ }, + { + header: 'UH Number', + accessorKey: 'uhUuid', + cell: ({ row }) =>
{row.getValue('uhUuid')}
+ }, + { + header: 'UH Username', + accessorKey: 'uid', + cell: ({ row }) =>
{row.getValue('uid')}
+ }, + { + header: 'Remove', + cell: ({ row }) => ( + + ) + } +]; + +export default AdminTableColumns; diff --git a/ui/src/components/table/groupings-table-skeleton.tsx b/ui/src/components/table/groupings-table/groupings-table-skeleton.tsx similarity index 95% rename from ui/src/components/table/groupings-table-skeleton.tsx rename to ui/src/components/table/groupings-table/groupings-table-skeleton.tsx index 82e03890..e912fb59 100644 --- a/ui/src/components/table/groupings-table-skeleton.tsx +++ b/ui/src/components/table/groupings-table/groupings-table-skeleton.tsx @@ -1,6 +1,6 @@ import { Skeleton } from '@/components/ui/skeleton'; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table'; -import GroupingsTableColumns from '@/components/table/table-element/groupings-table-columns'; +import GroupingsTableColumns from '@/components/table/groupings-table/table-element/groupings-table-columns'; const GroupingsTableSkeleton = () => { const pageSize = 7; // Average number of rows diff --git a/ui/src/components/table/groupings-table.tsx b/ui/src/components/table/groupings-table/groupings-table.tsx similarity index 93% rename from ui/src/components/table/groupings-table.tsx rename to ui/src/components/table/groupings-table/groupings-table.tsx index 2a921be0..e1db2bf0 100644 --- a/ui/src/components/table/groupings-table.tsx +++ b/ui/src/components/table/groupings-table/groupings-table.tsx @@ -18,7 +18,7 @@ import SortArrow from '@/components/table/table-element/sort-arrow'; import { useState } from 'react'; import { useLocalStorage } from 'usehooks-ts'; import { GroupingPath } from '@/lib/types'; -import GroupingsTableColumns from '@/components/table/table-element/groupings-table-columns'; +import GroupingsTableColumns from '@/components/table/groupings-table/table-element/groupings-table-columns'; import dynamic from 'next/dynamic'; import GroupingsTableSkeleton from './groupings-table-skeleton'; @@ -52,7 +52,11 @@ const GroupingsTable = ({ groupingPaths }: { groupingPaths: GroupingPath[] }) =>

Manage Groupings

- +
diff --git a/ui/src/components/table/table-element/ grouping-description-cell.tsx b/ui/src/components/table/groupings-table/table-element/grouping-description-cell.tsx similarity index 100% rename from ui/src/components/table/table-element/ grouping-description-cell.tsx rename to ui/src/components/table/groupings-table/table-element/grouping-description-cell.tsx diff --git a/ui/src/components/table/table-element/ grouping-name-cell.tsx b/ui/src/components/table/groupings-table/table-element/grouping-name-cell.tsx similarity index 100% rename from ui/src/components/table/table-element/ grouping-name-cell.tsx rename to ui/src/components/table/groupings-table/table-element/grouping-name-cell.tsx diff --git a/ui/src/components/table/table-element/grouping-path-cell.tsx b/ui/src/components/table/groupings-table/table-element/grouping-path-cell.tsx similarity index 100% rename from ui/src/components/table/table-element/grouping-path-cell.tsx rename to ui/src/components/table/groupings-table/table-element/grouping-path-cell.tsx diff --git a/ui/src/components/table/table-element/groupings-table-columns.tsx b/ui/src/components/table/groupings-table/table-element/groupings-table-columns.tsx similarity index 73% rename from ui/src/components/table/table-element/groupings-table-columns.tsx rename to ui/src/components/table/groupings-table/table-element/groupings-table-columns.tsx index dc73130e..1c4e025c 100644 --- a/ui/src/components/table/table-element/groupings-table-columns.tsx +++ b/ui/src/components/table/groupings-table/table-element/groupings-table-columns.tsx @@ -1,8 +1,8 @@ import { ColumnDef } from '@tanstack/react-table'; import { GroupingPath } from '@/lib/types'; -import GroupingPathCell from '@/components/table/table-element/grouping-path-cell'; -import GroupingDescriptionCell from '@/components/table/table-element/ grouping-description-cell'; -import GroupingNameCell from '@/components/table/table-element/ grouping-name-cell'; +import GroupingPathCell from '@/components/table/groupings-table/table-element/grouping-path-cell'; +import GroupingDescriptionCell from '@/components/table/groupings-table/table-element/grouping-description-cell'; +import GroupingNameCell from '@/components/table/groupings-table/table-element/grouping-name-cell'; const GroupingsTableColumns: ColumnDef[] = [ { diff --git a/ui/src/components/table/table-element/global-filter.tsx b/ui/src/components/table/table-element/global-filter.tsx index 2977f36f..52f0072e 100644 --- a/ui/src/components/table/table-element/global-filter.tsx +++ b/ui/src/components/table/table-element/global-filter.tsx @@ -1,8 +1,14 @@ import { Input } from '@/components/ui/input'; import { Dispatch, SetStateAction } from 'react'; -const GlobalFilter = ({ filter, setFilter }: { filter: string; setFilter: Dispatch> }) => ( - setFilter(e.target.value)} /> -); +const GlobalFilter = ({ + placeholder, + filter, + setFilter +}: { + placeholder: string; + filter: string; + setFilter: Dispatch>; +}) => setFilter(e.target.value)} />; export default GlobalFilter; diff --git a/ui/src/components/ui/dialog.tsx b/ui/src/components/ui/dialog.tsx new file mode 100644 index 00000000..921bb10c --- /dev/null +++ b/ui/src/components/ui/dialog.tsx @@ -0,0 +1,114 @@ +'use client'; + +import * as React from 'react'; +import * as DialogPrimitive from '@radix-ui/react-dialog'; +import { X } from 'lucide-react'; + +import { cn } from '@/components/ui/utils'; + +const Dialog = DialogPrimitive.Root; + +const DialogTrigger = DialogPrimitive.Trigger; + +const DialogPortal = DialogPrimitive.Portal; + +const DialogClose = DialogPrimitive.Close; + +const DialogOverlay = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)); +DialogOverlay.displayName = DialogPrimitive.Overlay.displayName; + +const DialogContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + + + + {children} + + + Close + + + +)); +DialogContent.displayName = DialogPrimitive.Content.displayName; + +const DialogHeader = ({ className, ...props }: React.HTMLAttributes) => ( +
+); +DialogHeader.displayName = 'DialogHeader'; + +const DialogFooter = ({ className, ...props }: React.HTMLAttributes) => ( +
+); +DialogFooter.displayName = 'DialogFooter'; + +const DialogTitle = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)); +DialogTitle.displayName = DialogPrimitive.Title.displayName; + +const DialogDescription = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)); +DialogDescription.displayName = DialogPrimitive.Description.displayName; + +export { + Dialog, + DialogPortal, + DialogOverlay, + DialogClose, + DialogTrigger, + DialogContent, + DialogHeader, + DialogFooter, + DialogTitle, + DialogDescription +}; diff --git a/ui/src/components/ui/pagination.tsx b/ui/src/components/ui/pagination.tsx index 8c24a1f3..b1d13e76 100644 --- a/ui/src/components/ui/pagination.tsx +++ b/ui/src/components/ui/pagination.tsx @@ -57,6 +57,7 @@ const PaginationLink = ({ {...props} /> ) + PaginationLink.displayName = 'PaginationLink' const PaginationPrevious = ({ diff --git a/ui/src/lib/fetchers.ts b/ui/src/lib/fetchers.ts index 4eafe814..dc7a2558 100644 --- a/ui/src/lib/fetchers.ts +++ b/ui/src/lib/fetchers.ts @@ -7,7 +7,8 @@ import { GroupingGroupMembers, GroupingPaths, MembershipResults, - GroupingGroupsMembers + GroupingGroupsMembers, + ApiError } from './types'; import { getUser } from '@/lib/access/user'; @@ -96,9 +97,9 @@ export const groupingOptAttributes = async (groupingPath: string): Promise => { +export const groupingAdmins = async (): Promise => { const currentUser = await getUser(); - const endpoint = `${baseUrl}/grouping-admins`; + const endpoint = `${baseUrl}/groupings/admins`; return getRequest(endpoint, currentUser.uid); }; @@ -107,9 +108,9 @@ export const groupingAdmins = async (): Promise => { * * @returns The promise of all the grouping paths */ -export const getAllGroupings = async (): Promise => { +export const getAllGroupings = async (): Promise => { const currentUser = await getUser(); - const endpoint = `${baseUrl}/all-groupings`; + const endpoint = `${baseUrl}/groupings`; return getRequest(endpoint, currentUser.uid); }; diff --git a/ui/tailwind.config.ts b/ui/tailwind.config.ts index 61ef64fd..1d5e3e0a 100644 --- a/ui/tailwind.config.ts +++ b/ui/tailwind.config.ts @@ -61,4 +61,4 @@ const config = { plugins: [require('tailwindcss-animate')] } satisfies Config; -export default config; +export default config; \ No newline at end of file diff --git a/ui/tests/app/admin/page.test.tsx b/ui/tests/app/admin/page.test.tsx index 741e5f23..92ec293a 100644 --- a/ui/tests/app/admin/page.test.tsx +++ b/ui/tests/app/admin/page.test.tsx @@ -1,27 +1,82 @@ -import AdminLayout from '@/app/admin/layout'; +//TODO: import AdminLayout from '@/app/admin/layout'; import Admin from '@/app/admin/page'; -import { render, screen } from '@testing-library/react'; +import { render, screen, waitFor } from '@testing-library/react'; +import * as Fetchers from '@/lib/fetchers'; +import { MemberResult, GroupingPaths } from '@/lib/types'; +import Groupings from '@/app/groupings/page'; + +jest.mock('@/lib/fetchers'); + +const mockGroupingsData: GroupingPaths = { + resultCode: 'SUCCESS', + groupingPaths: Array.from({ length: 10 }, (_, i) => ({ + path: `tmp:example:example-${i}`, + name: `example-${i}`, + description: `Test Description ${i}` + })) +}; + +const mockAdminsData: MemberResult = { + resultCode: 'SUCCESS', + members: Array.from({ length: 10 }, (_, i) => ({ + name: `example-${i}`, + uid: `example-${i}`, + uhUuid: `example-${i}` + })) +}; + +beforeEach(() => { + jest.spyOn(Fetchers, 'ownerGroupings').mockResolvedValue(mockGroupingsData); + jest.spyOn(Fetchers, 'groupingAdmins').mockResolvedValue(mockAdminsData); +}); + +describe('Groupings', () => { + it('renders the Groupings page with the appropriate header and group data', async () => { + render(await Groupings()); + await waitFor(async () => { + expect(screen.getByRole('table')).toBeInTheDocument(); + }); + + await waitFor(async () => { + mockGroupingsData.groupingPaths.forEach((group) => { + expect(screen.getByText(group.name)).toBeInTheDocument(); + expect(screen.getByText(group.description)).toBeInTheDocument(); + }); + }); + }); +}); describe('Admin', () => { - it('should render the Admin page with the appropriate header and tabs', () => { - render( - - - - ); - expect(screen.getByRole('main')).toBeInTheDocument(); - - expect(screen.getByRole('heading', { name: 'UH Groupings Administration' })).toBeInTheDocument(); + it('should render the Admin page with the appropriate header and tabs', async () => { + render(await Admin()); + + await waitFor(async () => { + expect(screen.getByRole('table')).toBeInTheDocument(); + }); + + await waitFor(async () => { + expect(screen.getByRole('main')).toBeInTheDocument(); + }); + + /*expect(screen.getByRole('heading', { name: 'UH Groupings Administration' })).toBeInTheDocument(); expect( screen.getByText( 'Search for and manage any grouping on behalf of its owner. ' + 'Manage the list of UH Groupings administrators.' ) - ).toBeInTheDocument(); + ).toBeInTheDocument();*/ - expect(screen.getByRole('tablist')).toBeInTheDocument(); - expect(screen.getByRole('tab', { name: 'Manage Groupings' })).toBeInTheDocument(); - expect(screen.getByRole('tab', { name: 'Manage Admins' })).toBeInTheDocument(); - expect(screen.getByRole('tab', { name: 'Manage Person' })).toBeInTheDocument(); + await waitFor(async () => { + expect(screen.getByRole('tablist')).toBeInTheDocument(); + }); + await waitFor(async () => { + expect(screen.getByRole('tab', { name: 'Manage Groupings' })).toBeInTheDocument(); + }); + await waitFor(async () => { + expect(screen.getByRole('tab', { name: 'Manage Admins' })).toBeInTheDocument(); + }); + await waitFor(async () => { + expect(screen.getByRole('tab', { name: 'Manage Person' })).toBeInTheDocument(); + }); }); }); diff --git a/ui/tests/components/table/groupings-table-skeleton.test.tsx b/ui/tests/components/table/groupings-table-skeleton.test.tsx index b8dcf820..b9d5cd4b 100644 --- a/ui/tests/components/table/groupings-table-skeleton.test.tsx +++ b/ui/tests/components/table/groupings-table-skeleton.test.tsx @@ -1,4 +1,4 @@ -import GroupingsTableSkeleton from '@/components/table/groupings-table-skeleton'; +import GroupingsTableSkeleton from '@/components/table/groupings-table/groupings-table-skeleton'; import { render, screen } from '@testing-library/react'; describe('GroupingsTableSkeleton', () => { diff --git a/ui/tests/components/table/groupings-table.test.tsx b/ui/tests/components/table/groupings-table/groupings-table.test.tsx similarity index 99% rename from ui/tests/components/table/groupings-table.test.tsx rename to ui/tests/components/table/groupings-table/groupings-table.test.tsx index 2f367228..54babd53 100644 --- a/ui/tests/components/table/groupings-table.test.tsx +++ b/ui/tests/components/table/groupings-table/groupings-table.test.tsx @@ -1,5 +1,5 @@ import { fireEvent, render, screen, waitFor } from '@testing-library/react'; -import GroupingsTable from '@/components/table/groupings-table'; +import GroupingsTable from '@/components/table/groupings-table/groupings-table'; import userEvent from '@testing-library/user-event'; const pageSize = parseInt(process.env.NEXT_PUBLIC_PAGE_SIZE as string); diff --git a/ui/tests/components/table/table-element/grouping-description-cell.test.tsx b/ui/tests/components/table/groupings-table/table-element/grouping-description-cell.test.tsx similarity index 90% rename from ui/tests/components/table/table-element/grouping-description-cell.test.tsx rename to ui/tests/components/table/groupings-table/table-element/grouping-description-cell.test.tsx index cd38b1ef..684acf8a 100644 --- a/ui/tests/components/table/table-element/grouping-description-cell.test.tsx +++ b/ui/tests/components/table/groupings-table/table-element/grouping-description-cell.test.tsx @@ -1,6 +1,6 @@ import { render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import GroupingDescriptionCell from '@/components/table/table-element/ grouping-description-cell'; +import GroupingDescriptionCell from '@/components/table/groupings-table/table-element/grouping-description-cell'; describe('GroupingDescriptionCell', () => { it('renders the description inside TooltipOnTruncate', () => { diff --git a/ui/tests/components/table/table-element/grouping-name-cell.test.tsx b/ui/tests/components/table/groupings-table/table-element/grouping-name-cell.test.tsx similarity index 84% rename from ui/tests/components/table/table-element/grouping-name-cell.test.tsx rename to ui/tests/components/table/groupings-table/table-element/grouping-name-cell.test.tsx index 218783bf..c6533cd3 100644 --- a/ui/tests/components/table/table-element/grouping-name-cell.test.tsx +++ b/ui/tests/components/table/groupings-table/table-element/grouping-name-cell.test.tsx @@ -1,5 +1,5 @@ import { render, screen} from '@testing-library/react'; -import GroupingNameCell from '@/components/table/table-element/ grouping-name-cell'; +import GroupingNameCell from '@/components/table/groupings-table/table-element/grouping-name-cell'; describe('GroupingNameCell', () => { it('renders the link with the correct path and displays the name', () => { diff --git a/ui/tests/components/table/table-element/grouping-path-cell.test.tsx b/ui/tests/components/table/groupings-table/table-element/grouping-path-cell.test.tsx similarity index 96% rename from ui/tests/components/table/table-element/grouping-path-cell.test.tsx rename to ui/tests/components/table/groupings-table/table-element/grouping-path-cell.test.tsx index 0b5ebe4e..83351534 100644 --- a/ui/tests/components/table/table-element/grouping-path-cell.test.tsx +++ b/ui/tests/components/table/groupings-table/table-element/grouping-path-cell.test.tsx @@ -1,5 +1,5 @@ import { fireEvent, render, screen, waitFor } from '@testing-library/react'; -import GroupingPathCell from '@/components/table/table-element/grouping-path-cell'; +import GroupingPathCell from '@/components/table/groupings-table/table-element/grouping-path-cell'; import userEvent from '@testing-library/user-event'; describe('GroupingPathCell', () => { diff --git a/ui/tests/components/table/table-element/global-filter.test.tsx b/ui/tests/components/table/table-element/global-filter.test.tsx index 16c78528..5de9623d 100644 --- a/ui/tests/components/table/table-element/global-filter.test.tsx +++ b/ui/tests/components/table/table-element/global-filter.test.tsx @@ -5,12 +5,12 @@ describe('GlobalFilter', () => { const mockSetFilter = jest.fn(); it('renders the input with correct placeholder and value', () => { - render(); + render(); expect(screen.getByPlaceholderText('Filter Groupings...')).toHaveValue('test'); }); it('renders call setFilter when the input value changes', () => { - render(); + render(); fireEvent.change(screen.getByPlaceholderText('Filter Groupings...'), { target: { value: 'new test' } }); expect(mockSetFilter).toHaveBeenCalledWith('new test'); diff --git a/ui/tests/lib/fetchers.test.ts b/ui/tests/lib/fetchers.test.ts index ae069236..2640c2ff 100644 --- a/ui/tests/lib/fetchers.test.ts +++ b/ui/tests/lib/fetchers.test.ts @@ -52,7 +52,7 @@ describe('fetchers', () => { describe('getAllGroupings', () => { it('should make a GET request at the correct endpoint', async () => { await getAllGroupings(); - expect(fetch).toHaveBeenCalledWith(`${baseUrl}/all-groupings`, { + expect(fetch).toHaveBeenCalledWith(`${baseUrl}/groupings`, { headers: { current_user: currentUser.uid } }); }); @@ -220,7 +220,7 @@ describe('fetchers', () => { describe('groupingAdmins', () => { it('should make a GET request at the correct endpoint', async () => { await groupingAdmins(); - expect(fetch).toHaveBeenCalledWith(`${baseUrl}/grouping-admins`, { + expect(fetch).toHaveBeenCalledWith(`${baseUrl}/groupings/admins`, { headers: { current_user: currentUser.uid } }); });