Skip to content

Commit

Permalink
Written test for quote component
Browse files Browse the repository at this point in the history
  • Loading branch information
jensmo98 committed Sep 20, 2023
1 parent 6de5324 commit 1d96c5a
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions packages/react/src/components/Quote/Quote.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,24 @@ import type { QuoteProps } from './Quote';
import { Quote } from './Quote';

describe('Quote', () => {
it('should have the myClass class', () => {
it('should render the quote text and author correctly', () => {
const author = 'John Doe';
const quoteText = 'This is a test quote';

render({
children: 'myComponent',
author,
children: quoteText,
});
expect(screen.getByText(quoteText)).toBeInTheDocument();
expect(screen.getByText(author)).toBeInTheDocument();
});

it('should apply the "quoteWrapper" class', () => {
const { container } = render({
author: 'Author',
children: 'Quote Text',
});
const list = screen.getByRole('list');
expect(list.classList).toContain('myClass');
expect(container.querySelector('.quoteWrapper')).toBeInTheDocument();
});
});

Expand Down

0 comments on commit 1d96c5a

Please sign in to comment.