Skip to content

Commit

Permalink
Adjust test snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
arnautov-anton committed Aug 5, 2024
1 parent 5495ed0 commit 1456257
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 12 deletions.
23 changes: 17 additions & 6 deletions src/components/Avatar/__tests__/Avatar.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,25 @@ describe('Avatar', () => {
const tree = renderer.create(<Avatar />).toJSON();
expect(tree).toMatchInlineSnapshot(`
<div
className="str-chat__avatar str-chat__message-sender-avatar"
className="str-chat__avatar str-chat__message-sender-avatar str-chat__avatar--no-letters"
data-testid="avatar"
onClick={[Function]}
onMouseOver={[Function]}
role="button"
>
<div
className="str-chat__avatar-fallback"
data-testid="avatar-fallback"
/>
<svg
className="str-chat__icon str-chat__icon--user"
fill="none"
height="16"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M8 2C9.1 2 10 2.9 10 4C10 5.1 9.1 6 8 6C6.9 6 6 5.1 6 4C6 2.9 6.9 2 8 2ZM8 12C10.7 12 13.8 13.29 14 14H2C2.23 13.28 5.31 12 8 12ZM8 0C5.79 0 4 1.79 4 4C4 6.21 5.79 8 8 8C10.21 8 12 6.21 12 4C12 1.79 10.21 0 8 0ZM8 10C5.33 10 0 11.34 0 14V16H16V14C16 11.34 10.67 10 8 10Z"
fill="currentColor"
/>
</svg>
</div>
`);
});
Expand All @@ -33,10 +43,11 @@ describe('Avatar', () => {
const tree = renderer.create(<Avatar image='random' />).toJSON();
expect(tree).toMatchInlineSnapshot(`
<div
className="str-chat__avatar str-chat__message-sender-avatar"
className="str-chat__avatar str-chat__message-sender-avatar str-chat__avatar--no-letters"
data-testid="avatar"
onClick={[Function]}
onMouseOver={[Function]}
role="button"
>
<img
alt=""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ exports[`ChannelPreviewMessenger should render correctly 1`] = `
data-testid="avatar"
onClick={[Function]}
onMouseOver={[Function]}
role="button"
title="Channel name"
>
<img
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ exports[`MessageStatus renders default read UI for the last message 1`] = `
<div
class="str-chat__avatar str-chat__message-sender-avatar str-chat__avatar--message-status str-chat__avatar--one-letter"
data-testid="avatar"
role="button"
title="other-user"
>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,13 @@ describe('VirtualizedMessageComponents', () => {
it('should not render custom head in Header when not loading more messages', () => {
const context = { head };
const { container } = renderElements(<Header context={context} />);
expect(container).toMatchInlineSnapshot(`<div />`);
expect(container).toMatchInlineSnapshot(`
<div>
<div>
Custom head
</div>
</div>
`);
});

it('should render custom LoadingIndicator instead of head when loading more', () => {
Expand All @@ -150,6 +156,9 @@ describe('VirtualizedMessageComponents', () => {
const { container } = renderElements(<Header context={context} />, componentContext);
expect(container).toMatchInlineSnapshot(`
<div>
<div>
Custom head
</div>
<div
class="str-chat__virtual-list__loading"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ exports[`VirtualizedMessageComponents EmptyPlaceholder should render for main me

exports[`VirtualizedMessageComponents Header should not render custom head in Header when loading more messages, but the LoadingIndicator 1`] = `
<div>
<div>
Custom head
</div>
<div
class="str-chat__virtual-list__loading"
>
Expand Down
20 changes: 15 additions & 5 deletions src/components/UserItem/__tests__/UserItem.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,25 @@ describe('UserItem', () => {
className="str-chat__user-item"
>
<div
className="str-chat__avatar str-chat__message-sender-avatar str-chat__avatar--autocomplete-item"
className="str-chat__avatar str-chat__message-sender-avatar str-chat__avatar--autocomplete-item str-chat__avatar--no-letters"
data-testid="avatar"
onClick={[Function]}
onMouseOver={[Function]}
role="button"
>
<div
className="str-chat__avatar-fallback"
data-testid="avatar-fallback"
/>
<svg
className="str-chat__icon str-chat__icon--user"
fill="none"
height="16"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M8 2C9.1 2 10 2.9 10 4C10 5.1 9.1 6 8 6C6.9 6 6 5.1 6 4C6 2.9 6.9 2 8 2ZM8 12C10.7 12 13.8 13.29 14 14H2C2.23 13.28 5.31 12 8 12ZM8 0C5.79 0 4 1.79 4 4C4 6.21 5.79 8 8 8C10.21 8 12 6.21 12 4C12 1.79 10.21 0 8 0ZM8 10C5.33 10 0 11.34 0 14V16H16V14C16 11.34 10.67 10 8 10Z"
fill="currentColor"
/>
</svg>
</div>
<span
className="str-chat__user-item--name"
Expand Down

0 comments on commit 1456257

Please sign in to comment.