From bfa0953d1463028e5f7677eeddca19b54bb2e296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B4mulo=20Penido?= Date: Wed, 25 Oct 2023 15:56:45 -0300 Subject: [PATCH] test: add TaxonomyDetailSideCard.test.jsx --- .../TaxonomyDetailSideCard.test.jsx | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/taxonomy/taxonomy-detail/TaxonomyDetailSideCard.test.jsx diff --git a/src/taxonomy/taxonomy-detail/TaxonomyDetailSideCard.test.jsx b/src/taxonomy/taxonomy-detail/TaxonomyDetailSideCard.test.jsx new file mode 100644 index 0000000000..966d04fa44 --- /dev/null +++ b/src/taxonomy/taxonomy-detail/TaxonomyDetailSideCard.test.jsx @@ -0,0 +1,53 @@ +import React from 'react'; +import { IntlProvider, injectIntl } from '@edx/frontend-platform/i18n'; +import { initializeMockApp } from '@edx/frontend-platform'; +import { AppProvider } from '@edx/frontend-platform/react'; +import { render } from '@testing-library/react'; +import PropTypes from 'prop-types'; + +import initializeStore from '../../store'; + +import TaxonomyDetailSideCard from './TaxonomyDetailSideCard'; + +let store; + +const data = { + id: 1, + name: 'Taxonomy 1', + description: 'This is a description', +}; + +const TaxonomyCardComponent = ({ taxonomy }) => ( + + + + + +); + +TaxonomyCardComponent.propTypes = { + taxonomy: PropTypes.shape({ + name: PropTypes.string, + description: PropTypes.string, + }).isRequired, +}; + +describe('', async () => { + beforeEach(async () => { + initializeMockApp({ + authenticatedUser: { + userId: 3, + username: 'abc123', + administrator: true, + roles: [], + }, + }); + store = initializeStore(); + }); + + it('should render title and description of the card', () => { + const { getByText } = render(); + expect(getByText(data.name)).toBeInTheDocument(); + expect(getByText(data.description)).toBeInTheDocument(); + }); +});