Port test from js to tsx

This commit is contained in:
Oliver Sand
2021-02-01 12:38:38 +01:00
parent ac396e8e0b
commit f041e92e13
2 changed files with 7 additions and 13 deletions
@@ -44,22 +44,16 @@ describe('<ToolCard />', () => {
it('should link out', () => {
const rendered = render(wrapInTestApp(<ToolCard {...minProps} />));
const anchor = rendered.container.querySelector('a');
expect(anchor.href).toBe(minProps.card.url);
expect(anchor).toHaveAttribute('href', minProps.card.url);
});
it('renders default description when missing', () => {
const propsWithoutDescription = {
card: {
card: {
title: 'Title',
url: 'http://spotify.com/',
image: 'https://developer.spotify.com/assets/WebAPI_intro.png',
},
},
const card = {
title: 'Title',
url: 'http://spotify.com/',
image: 'https://developer.spotify.com/assets/WebAPI_intro.png',
};
const { getByText } = render(
wrapInTestApp(<ToolCard {...propsWithoutDescription} />),
);
const { getByText } = render(wrapInTestApp(<ToolCard card={card} />));
expect(getByText('Description missing')).toBeInTheDocument();
});