Skip to content

Commit 3912d4d

Browse files
author
Hector Arce De Las Heras
committed
Improve avatar test with new variants
1 parent 7e2a4d4 commit 3912d4d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/components/avatar/__tests__/avatar.test.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ const mockProps = {
1919
onClick: jest.fn(),
2020
};
2121

22+
const mockPropsWithoutOnClick = {
23+
size: 'SMALL',
24+
dot: {
25+
variant: 'WITH_BORDER',
26+
size: 'BIG',
27+
number: 1,
28+
maxNumber: 2,
29+
},
30+
};
31+
2232
describe('Avatar component', () => {
2333
test('Should render Avatar with Initials component', async () => {
2434
const { container } = renderProvider(<Avatar {...mockProps} initials={{ content: 'HA' }} />);
@@ -30,6 +40,18 @@ describe('Avatar component', () => {
3040
expect(results).toHaveNoViolations();
3141
});
3242

43+
test('Should render Avatar with Initials component without onclick', async () => {
44+
const { container } = renderProvider(
45+
<Avatar {...mockPropsWithoutOnClick} initials={{ content: 'HA' }} />
46+
);
47+
const avatar = screen.queryByText('HA');
48+
expect(avatar).toBeDefined();
49+
50+
const results = await axe(container);
51+
expect(container).toHTMLValidate();
52+
expect(results).toHaveNoViolations();
53+
});
54+
3355
test('Should render Avatar with Icon component', async () => {
3456
const { container } = renderProvider(<Avatar {...mockProps} icon={{ icon: 'ARROW_ICON' }} />);
3557
const avatar = screen.queryByText('1');

0 commit comments

Comments
 (0)