Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

Commit

Permalink
test: add test for button link
Browse files Browse the repository at this point in the history
Signed-off-by: Logan McAnsh <[email protected]>
  • Loading branch information
mcansh committed Oct 29, 2019
1 parent 71f8043 commit 0351b98
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion __tests__/components/header/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';

import { render } from '~/utils/render-with-intl';
import Header from '~/components/header/index';
import Header from '~/components/header';

describe('Header Component', () => {
it('shows custom text and image', () => {
Expand All @@ -21,4 +21,17 @@ describe('Header Component', () => {
'https://res.cloudinary.com/dof0zryca/image/upload/f_auto/v1541889199/blog/1*Wmv8hfi_bTHuHyV5CawnCw.jpg'
);
});
it('shows "Read More" button when passed a link', () => {
const { getByText } = render(
<Header
image={{ imageUrl: '1*Wmv8hfi_bTHuHyV5CawnCw.jpg' }}
url="https://google.com"
title="My sweet new blog post!"
/>
);
expect(getByText('Read More').parentElement!).toHaveAttribute(
'href',
'https://google.com'
);
});
});

0 comments on commit 0351b98

Please sign in to comment.