diff --git a/src/people/widgetViews/__tests__/UsersList.spec.tsx b/src/people/widgetViews/__tests__/UsersList.spec.tsx new file mode 100644 index 00000000..a938b481 --- /dev/null +++ b/src/people/widgetViews/__tests__/UsersList.spec.tsx @@ -0,0 +1,60 @@ +import React from 'react'; +import { render } from '@testing-library/react'; +import '@testing-library/jest-dom'; +import Users from '../organization/UsersList.tsx'; + +jest.mock('store', () => ({ + useStores: () => ({ + main: { + bountyRoles: [] + }, + ui: { + meInfo: { + owner_pubkey: 'mocked_pubkey' + } + } + }) +})); + +const mockedUsers = [ + { + owner_pubkey: 'user1_pubkey', + owner_alias: 'User 1', + img: '' + }, + { + owner_pubkey: 'mocked_pubkey', + owner_alias: 'User 2', + img: '' + } +]; + +const props = { + users: mockedUsers, + userRoles: ['VIEW'], + handleDeleteClick: jest.fn(), + handleSettingsClick: jest.fn(), + org: { owner_pubkey: 'org_pubkey' } +}; + +describe('Users Component', () => { + test('displays not-allowed cursor over disabled settings button', () => { + // @ts-ignore + const { getAllByTestId } = render(); + const settingsIcons = getAllByTestId('settings-icon'); + // eslint-disable-next-line @typescript-eslint/typedef + settingsIcons.forEach((icon) => { + expect(icon).toHaveStyle('cursor: not-allowed'); + }); + }); + + test('displays not-allowed cursor over disabled delete button', () => { + // @ts-ignore + const { getAllByTestId } = render(); + const deleteIcons = getAllByTestId('delete-icon'); + // eslint-disable-next-line @typescript-eslint/typedef + deleteIcons.forEach((icon) => { + expect(icon).toHaveStyle('cursor: not-allowed'); + }); + }); +}); diff --git a/src/people/widgetViews/organization/UsersList.tsx b/src/people/widgetViews/organization/UsersList.tsx index 24f7f77b..dcbae808 100644 --- a/src/people/widgetViews/organization/UsersList.tsx +++ b/src/people/widgetViews/organization/UsersList.tsx @@ -46,10 +46,11 @@ const Users = (props: UserListProps) => { handleSettingsClick(user)} @@ -59,10 +60,11 @@ const Users = (props: UserListProps) => { {