🌐(app-desk) translate role in member grid

The roles in the member grid were not being translated.
This commit adds the translation for
the roles in the member grid.
This commit is contained in:
Anthony LC
2024-03-08 16:46:07 +01:00
committed by Anthony LC
parent e15c7cb2f4
commit a15e46a2f9
3 changed files with 14 additions and 5 deletions
@@ -84,9 +84,9 @@ describe('MemberGrid', () => {
expect(screen.getByText('[email protected]')).toBeInTheDocument();
expect(screen.getByText('[email protected]')).toBeInTheDocument();
expect(screen.getByText('[email protected]')).toBeInTheDocument();
expect(screen.getByText(Role.OWNER)).toBeInTheDocument();
expect(screen.getByText(Role.ADMIN)).toBeInTheDocument();
expect(screen.getByText(Role.MEMBER)).toBeInTheDocument();
expect(screen.getByText('Owner')).toBeInTheDocument();
expect(screen.getByText('Admin')).toBeInTheDocument();
expect(screen.getByText('Member')).toBeInTheDocument();
});
it('checks the pagination', async () => {
@@ -33,6 +33,12 @@ export const MemberGrid = ({ teamId, currentRole }: MemberGridProps) => {
setPagesCount(data?.count ? Math.ceil(data.count / pageSize) : 0);
}, [data?.count, pageSize, setPagesCount]);
const dictRole = {
[Role.ADMIN]: t('Admin'),
[Role.MEMBER]: t('Member'),
[Role.OWNER]: t('Owner'),
};
return (
<Card
className="m-b pb-s"
@@ -78,8 +84,11 @@ export const MemberGrid = ({ teamId, currentRole }: MemberGridProps) => {
headerName: t('Emails'),
},
{
field: 'role',
id: 'role',
headerName: t('Roles'),
renderCell({ row }) {
return dictRole[row.role];
},
},
{
id: 'column-actions',
@@ -60,7 +60,7 @@ test.describe('Team', () => {
new RegExp(`E2E ${browserName}`, 'i'),
);
await expect(cells.nth(2)).toHaveText(`user@${browserName}.e2e`);
await expect(cells.nth(3)).toHaveText('owner');
await expect(cells.nth(3)).toHaveText(/Owner/i);
});
test('try to update the owner role but cannot because it is the last owner', async ({