bigbuffet-rw/app/soapbox/components/ui/card/__tests__/card.test.js
2022-03-21 13:14:26 -05:00

37 lines
911 B
JavaScript

import React from 'react';
import { createShallowComponent } from 'soapbox/test_helpers';
import { Card, CardBody, CardHeader, CardTitle } from '../card';
describe('<Card />', () => {
it('renders the CardTitle and CardBody', () => {
const component = createShallowComponent(
<Card>
<CardHeader>
<CardTitle title='Card Title' />
</CardHeader>
<CardBody>
Card Body
</CardBody>
</Card>,
);
expect(component.text()).toContain('Card Title');
expect(component.text()).toContain('Card Body');
expect(component.text()).not.toContain('Back');
});
it('renders the Back Button', () => {
const component = createShallowComponent(
<Card>
<CardHeader backHref='/'>
<CardTitle title='Card Title' />
</CardHeader>
</Card>,
);
expect(component.text()).toContain('Back');
});
});