* Revert "(Temporarily) Remove multiple reactions from #index (#19142)" This reverts commita45d300639. * Clean up reaction category count mechanism for #index * Remove, unnecessary * Expose reaction categories in JSON response * Update test with new categories * Fix flaky sample / minimum floor * buildArticle (infinite scroll) with multiple reactions * If we're doing #index front-end, we aren't feature-flag'd * nbsp * react (home feed) has multiple_reactions * Update app/assets/javascripts/utilities/buildArticleHTML.js Co-authored-by: Rajat Talesra <rajat@forem.com> * Clean up Reactable#reaction_categories * Use 'multiple_reactions_icons_container' * Try adding a ReactionCount test * Adapt memory fix from76dd53d* Try adding categories to fixture * Attempt to eager-load distinct public categories * Setting dependent to the default for rubocop * Try making image assets more public? * Revert "Fix flaky sample / minimum floor" --------- Co-authored-by: Rajat Talesra <rajat@forem.com> Co-authored-by: Mac Siri <mac@forem.com>
38 lines
1.2 KiB
JavaScript
38 lines
1.2 KiB
JavaScript
import { h } from 'preact';
|
|
import { render } from '@testing-library/preact';
|
|
import '@testing-library/jest-dom';
|
|
import { ReactionsCount } from '..';
|
|
import {
|
|
articleWithReactions,
|
|
articleWithoutReactions,
|
|
} from '../../__tests__/utilities/articleUtilities.js';
|
|
|
|
describe('<ReactionsCount /> component', () => {
|
|
it('should not display reactions data when there are no reactions', async () => {
|
|
const { queryByText } = render(
|
|
<ReactionsCount article={articleWithoutReactions} />,
|
|
);
|
|
|
|
expect(queryByText('0 reactions')).toBeNull();
|
|
});
|
|
|
|
it('should display reactions data when there are reactions', async () => {
|
|
const { findByText } = render(
|
|
<ReactionsCount article={articleWithReactions} />,
|
|
);
|
|
|
|
expect(findByText('232 reactions')).toBeDefined();
|
|
});
|
|
|
|
it('should display multiple reactions when there are reactions', async () => {
|
|
const { findByText } = render(
|
|
<ReactionsCount article={articleWithReactions} />,
|
|
);
|
|
|
|
expect(
|
|
findByText(
|
|
'<span class="multiple_reactions_icons_container" dir="rtl"><span class="crayons_icon_container"><img src="/assets/like.svg" alt="Like" width="18" height="18"></span>',
|
|
),
|
|
).toBeDefined();
|
|
});
|
|
});
|