Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielchl committed Sep 13, 2024
1 parent d41277d commit a526cff
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 35 deletions.
13 changes: 0 additions & 13 deletions src/components/SpaceListItem/SpaceListItem.unit.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import Icon from '../Icon';
import { mountAndWait } from '../../../test/utils';
import ListItemBase from '../ListItemBase';
import * as ListContext from '../List/List.utils';
import { STYLE } from './SpaceListItem.constants';
import DividerDot from '../DividerDot';

describe('<SpaceListItem />', () => {
Expand Down Expand Up @@ -451,18 +450,6 @@ describe('<SpaceListItem />', () => {
expect(container.filter("[data-test='compact-mode-divider-dot']").length).toEqual(0);
});

it('should have provided isNewActivity class when isNewActivity is provided', async () => {
expect.assertions(1);

const isNewActivity = true;

const element = (await mountAndWait(<SpaceListItem isNewActivity={isNewActivity} />)).find(
ListItemBase
);

expect(element.hasClass(STYLE.isNewActivity)).toBe(true);
});

it('should have provided unread when isUnread is provided', async () => {
expect.assertions(1);

Expand Down
33 changes: 17 additions & 16 deletions src/components/SpaceListItem/SpaceListItem.unit.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ exports[`<SpaceListItem /> snapshot should match snapshot with isEnterRoom 1`] =
isEnterRoom={true}
>
<ListItemBase
className="md-space-list-item-wrapper md-space-list-item-is-new-activity"
className="md-space-list-item-wrapper"
isDisabled={false}
shape="isPilled"
size={50}
Expand All @@ -960,7 +960,7 @@ exports[`<SpaceListItem /> snapshot should match snapshot with isEnterRoom 1`] =
isInset={false}
>
<li
className="md-space-list-item-wrapper md-space-list-item-is-new-activity md-list-item-base-wrapper"
className="md-space-list-item-wrapper md-list-item-base-wrapper"
data-allow-text-select={false}
data-disabled={false}
data-interactive={true}
Expand Down Expand Up @@ -997,11 +997,11 @@ exports[`<SpaceListItem /> snapshot should match snapshot with isEnterRoom 1`] =
/>
</ListItemBaseSection>
<ListItemBaseSection
className="md-space-row-content-text-wrapper text-column"
className="md-space-row-content-text-wrapper text-column md-space-row-content-is-new-activity"
position="middle"
>
<div
className="md-space-row-content-text-wrapper text-column"
className="md-space-row-content-text-wrapper text-column md-space-row-content-is-new-activity"
data-position="middle"
>
<Text
Expand Down Expand Up @@ -1192,7 +1192,7 @@ exports[`<SpaceListItem /> snapshot should match snapshot with isMention 1`] = `
isMention={true}
>
<ListItemBase
className="md-space-list-item-wrapper md-space-list-item-is-new-activity"
className="md-space-list-item-wrapper"
isDisabled={false}
shape="isPilled"
size={50}
Expand All @@ -1206,7 +1206,7 @@ exports[`<SpaceListItem /> snapshot should match snapshot with isMention 1`] = `
isInset={false}
>
<li
className="md-space-list-item-wrapper md-space-list-item-is-new-activity md-list-item-base-wrapper"
className="md-space-list-item-wrapper md-list-item-base-wrapper"
data-allow-text-select={false}
data-disabled={false}
data-interactive={true}
Expand Down Expand Up @@ -1243,11 +1243,11 @@ exports[`<SpaceListItem /> snapshot should match snapshot with isMention 1`] = `
/>
</ListItemBaseSection>
<ListItemBaseSection
className="md-space-row-content-text-wrapper text-column"
className="md-space-row-content-text-wrapper text-column md-space-row-content-is-new-activity"
position="middle"
>
<div
className="md-space-row-content-text-wrapper text-column"
className="md-space-row-content-text-wrapper text-column md-space-row-content-is-new-activity"
data-position="middle"
>
<Text
Expand Down Expand Up @@ -1315,7 +1315,7 @@ exports[`<SpaceListItem /> snapshot should match snapshot with isNewActivity 1`]
isNewActivity={true}
>
<ListItemBase
className="md-space-list-item-wrapper md-space-list-item-is-new-activity"
className="md-space-list-item-wrapper"
isDisabled={false}
shape="isPilled"
size={50}
Expand All @@ -1329,7 +1329,7 @@ exports[`<SpaceListItem /> snapshot should match snapshot with isNewActivity 1`]
isInset={false}
>
<li
className="md-space-list-item-wrapper md-space-list-item-is-new-activity md-list-item-base-wrapper"
className="md-space-list-item-wrapper md-list-item-base-wrapper"
data-allow-text-select={false}
data-disabled={false}
data-interactive={true}
Expand All @@ -1356,6 +1356,7 @@ exports[`<SpaceListItem /> snapshot should match snapshot with isNewActivity 1`]
<SpaceRowContent
isCompact={false}
isDisabled={false}
isNewActivity={true}
>
<ListItemBaseSection
position="start"
Expand All @@ -1365,11 +1366,11 @@ exports[`<SpaceListItem /> snapshot should match snapshot with isNewActivity 1`]
/>
</ListItemBaseSection>
<ListItemBaseSection
className="md-space-row-content-text-wrapper text-column"
className="md-space-row-content-text-wrapper text-column md-space-row-content-is-new-activity"
position="middle"
>
<div
className="md-space-row-content-text-wrapper text-column"
className="md-space-row-content-text-wrapper text-column md-space-row-content-is-new-activity"
data-position="middle"
>
<Text
Expand Down Expand Up @@ -1625,7 +1626,7 @@ exports[`<SpaceListItem /> snapshot should match snapshot with isUnread 1`] = `
isUnread={true}
>
<ListItemBase
className="md-space-list-item-wrapper md-space-list-item-is-new-activity"
className="md-space-list-item-wrapper"
isDisabled={false}
shape="isPilled"
size={50}
Expand All @@ -1639,7 +1640,7 @@ exports[`<SpaceListItem /> snapshot should match snapshot with isUnread 1`] = `
isInset={false}
>
<li
className="md-space-list-item-wrapper md-space-list-item-is-new-activity md-list-item-base-wrapper"
className="md-space-list-item-wrapper md-list-item-base-wrapper"
data-allow-text-select={false}
data-disabled={false}
data-interactive={true}
Expand Down Expand Up @@ -1676,11 +1677,11 @@ exports[`<SpaceListItem /> snapshot should match snapshot with isUnread 1`] = `
/>
</ListItemBaseSection>
<ListItemBaseSection
className="md-space-row-content-text-wrapper text-column"
className="md-space-row-content-text-wrapper text-column md-space-row-content-is-new-activity"
position="middle"
>
<div
className="md-space-row-content-text-wrapper text-column"
className="md-space-row-content-text-wrapper text-column md-space-row-content-is-new-activity"
data-position="middle"
>
<Text
Expand Down
13 changes: 13 additions & 0 deletions src/components/SpaceRowContent/SpaceRowContent.unit.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Avatar from '../Avatar';
import Icon from '../Icon';
import { mountAndWait } from '../../../test/utils';
import DividerDot from '../DividerDot';
import ListItemBaseSection from '../ListItemBaseSection';

describe('<SpaceRowContent />', () => {
describe('snapshot', () => {
Expand Down Expand Up @@ -365,6 +366,18 @@ describe('<SpaceRowContent />', () => {
expect(container.filter("[data-test='compact-mode-divider-dot']").length).toEqual(0);
});

it('should have provided isNewActivity class when isNewActivity is provided', async () => {
expect.assertions(1);

const isNewActivity = true;

const element = (await mountAndWait(<SpaceRowContent isNewActivity={isNewActivity} />))
.find(ListItemBaseSection)
.find({ position: 'middle' });

expect(element.hasClass('md-space-row-content-is-new-activity')).toBe(true);
});

it('should have provided unread when isUnread is provided', async () => {
expect.assertions(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,11 @@ exports[`<SpaceRowContent /> snapshot should match snapshot with isEnterRoom 1`]
/>
</ListItemBaseSection>
<ListItemBaseSection
className="md-space-row-content-text-wrapper text-column"
className="md-space-row-content-text-wrapper text-column md-space-row-content-is-new-activity"
position="middle"
>
<div
className="md-space-row-content-text-wrapper text-column"
className="md-space-row-content-text-wrapper text-column md-space-row-content-is-new-activity"
data-position="middle"
>
<Text
Expand Down Expand Up @@ -571,11 +571,11 @@ exports[`<SpaceRowContent /> snapshot should match snapshot with isMention 1`] =
/>
</ListItemBaseSection>
<ListItemBaseSection
className="md-space-row-content-text-wrapper text-column"
className="md-space-row-content-text-wrapper text-column md-space-row-content-is-new-activity"
position="middle"
>
<div
className="md-space-row-content-text-wrapper text-column"
className="md-space-row-content-text-wrapper text-column md-space-row-content-is-new-activity"
data-position="middle"
>
<Text
Expand Down Expand Up @@ -763,11 +763,11 @@ exports[`<SpaceRowContent /> snapshot should match snapshot with isUnread 1`] =
/>
</ListItemBaseSection>
<ListItemBaseSection
className="md-space-row-content-text-wrapper text-column"
className="md-space-row-content-text-wrapper text-column md-space-row-content-is-new-activity"
position="middle"
>
<div
className="md-space-row-content-text-wrapper text-column"
className="md-space-row-content-text-wrapper text-column md-space-row-content-is-new-activity"
data-position="middle"
>
<Text
Expand Down

0 comments on commit a526cff

Please sign in to comment.