Created
November 7, 2018 19:55
-
-
Save kvendrik/424f6443b0575d5b38db354c6905cbad to your computer and use it in GitHub Desktop.
Link tests: href 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react'; | |
import {mount} from 'enzyme'; | |
import {UnstyledLink, Button} from '../components'; | |
import Link from '../Link'; | |
describe('<Link />', () => { | |
const mockProps = { | |
children: 'Click me!', | |
}; | |
describe('href', () => { | |
it('renders an UnstyledLink when given', () => { | |
const href = 'http://google.com'; | |
const link = mount(<Link {...mockProps} href={href} />); | |
expect(link.find(UnstyledLink).exists()).toBeTruthy(); | |
}); | |
it('renders a Button when not given', () => { | |
const link = mount(<Link {...mockProps} />); | |
expect(link.find(Button).exists()).toBeTruthy(); | |
}); | |
it('gets passed into UnstyledLink', () => { | |
const href = 'http://google.com'; | |
const link = mount(<Link {...mockProps} href={href} />); | |
expect(link.find(UnstyledLink).prop('url')).toBe(href); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment