bigbuffet-rw/app/soapbox/components/ui/card/__tests__/card.test.js

38 lines
911 B
JavaScript
Raw Normal View History

2022-03-21 11:09:01 -07:00
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');
});
});