adjusted tests and added testid prop
Signed-off-by: Stefan Petrovic <stefanp0618@gmail.com>
This commit is contained in:
@@ -193,11 +193,9 @@ describe('MemberTab Test', () => {
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
const toggleSwitch = screen.queryByRole('checkbox');
|
||||
expect(toggleSwitch).toBeNull();
|
||||
});
|
||||
|
||||
it('Shows the aggregate members toggle if the showAggregateMembersToggle prop is true', async () => {
|
||||
await renderInTestApp(
|
||||
<TestApiProvider
|
||||
@@ -221,10 +219,8 @@ describe('MemberTab Test', () => {
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
expect(screen.queryByRole('checkbox')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('Shows only direct members if the showAggregateMembersToggle prop is undefined', async () => {
|
||||
await renderInTestApp(
|
||||
<TestApiProvider
|
||||
@@ -248,11 +244,9 @@ describe('MemberTab Test', () => {
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
const displayedMemberNames = screen.queryAllByTestId('user-link');
|
||||
const duplicatedUserText = screen.getByText('Duplicated User');
|
||||
const groupAUserOneText = screen.getByText('Group A User One');
|
||||
|
||||
expect(displayedMemberNames).toHaveLength(2);
|
||||
expect(duplicatedUserText).toBeInTheDocument();
|
||||
expect(groupAUserOneText).toBeInTheDocument();
|
||||
@@ -260,7 +254,6 @@ describe('MemberTab Test', () => {
|
||||
duplicatedUserText.compareDocumentPosition(groupAUserOneText),
|
||||
).toBe(Node.DOCUMENT_POSITION_FOLLOWING);
|
||||
});
|
||||
|
||||
it('Shows only direct members if the aggregate members switch is turned off', async () => {
|
||||
await renderInTestApp(
|
||||
<TestApiProvider
|
||||
@@ -284,11 +277,9 @@ describe('MemberTab Test', () => {
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
const displayedMemberNames = screen.queryAllByTestId('user-link');
|
||||
const duplicatedUserText = screen.getByText('Duplicated User');
|
||||
const groupAUserOneText = screen.getByText('Group A User One');
|
||||
|
||||
expect(displayedMemberNames).toHaveLength(2);
|
||||
expect(duplicatedUserText).toBeInTheDocument();
|
||||
expect(groupAUserOneText).toBeInTheDocument();
|
||||
@@ -296,7 +287,6 @@ describe('MemberTab Test', () => {
|
||||
duplicatedUserText.compareDocumentPosition(groupAUserOneText),
|
||||
).toBe(Node.DOCUMENT_POSITION_FOLLOWING);
|
||||
});
|
||||
|
||||
it('Shows all descendant members of the group when the aggregate users switch is turned on, showing duplicated members only once', async () => {
|
||||
await renderInTestApp(
|
||||
<TestApiProvider
|
||||
@@ -320,25 +310,20 @@ describe('MemberTab Test', () => {
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
// Click the toggle switch
|
||||
await userEvent.click(screen.getByRole('checkbox'));
|
||||
|
||||
const displayedMemberNames = screen.queryAllByTestId('user-link');
|
||||
const duplicatedUserText = screen.getByText('Duplicated User');
|
||||
const groupAUserOneText = screen.getByText('Group A User One');
|
||||
const groupBUserOneText = screen.getByText('Group B User One');
|
||||
const groupDUserOneText = screen.getByText('Group D User One');
|
||||
const groupEUserOneText = screen.getByText('Group E User One');
|
||||
|
||||
expect(displayedMemberNames).toHaveLength(5);
|
||||
|
||||
expect(duplicatedUserText).toBeInTheDocument();
|
||||
expect(groupAUserOneText).toBeInTheDocument();
|
||||
expect(groupBUserOneText).toBeInTheDocument();
|
||||
expect(groupDUserOneText).toBeInTheDocument();
|
||||
expect(groupEUserOneText).toBeInTheDocument();
|
||||
|
||||
expect(
|
||||
duplicatedUserText.compareDocumentPosition(groupAUserOneText),
|
||||
).toBe(Node.DOCUMENT_POSITION_FOLLOWING);
|
||||
|
||||
@@ -98,7 +98,11 @@ const MemberComponent = (props: { member: UserEntity }) => {
|
||||
textAlign="center"
|
||||
>
|
||||
<Typography variant="h6">
|
||||
<EntityRefLink entityRef={props.member} title={displayName} />
|
||||
<EntityRefLink
|
||||
data-testid="user-link"
|
||||
entityRef={props.member}
|
||||
title={displayName}
|
||||
/>
|
||||
</Typography>
|
||||
{profile?.email && (
|
||||
<Link to={`mailto:${profile.email}`}>
|
||||
|
||||
Reference in New Issue
Block a user