1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-12-22 09:13:19 +01:00
This commit is contained in:
Matthias Kretschmann 2019-04-14 19:09:08 +02:00
parent 6bdcda3141
commit 0666dba344
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 19 additions and 14 deletions

1
.gitignore vendored
View File

@ -11,5 +11,4 @@ yarn-debug.log*
yarn.lock yarn.lock
package-lock.json package-lock.json
plugins/gatsby-plugin-matomo plugins/gatsby-plugin-matomo
src/components/svg
coverage coverage

View File

@ -1,10 +1,7 @@
sudo: required dist: xenial
language: node_js language: node_js
node_js: node node_js: node
addons:
chrome: beta
cache: cache:
directories: directories:
- node_modules - node_modules

View File

@ -4,21 +4,30 @@ import { render } from 'react-testing-library'
import LinkIcon from './LinkIcon' import LinkIcon from './LinkIcon'
describe('LinkIcon', () => { describe('LinkIcon', () => {
const link = {
title: 'my project',
type: 'website'
}
it('renders correctly', () => { it('renders correctly', () => {
const { container } = render( const { container, rerender } = render(
<LinkIcon title={link.title} type={link.type} /> <LinkIcon title={'my project'} type={'website'} />
) )
expect(container.firstChild.nodeName).toBe('svg') expect(container.firstChild.nodeName).toBe('svg')
rerender(<LinkIcon type={'github'} />)
expect(container.firstChild.nodeName).toBe('svg')
rerender(<LinkIcon type={'dribbble'} />)
expect(container.firstChild.nodeName).toBe('svg')
rerender(<LinkIcon type={'info'} />)
expect(container.firstChild.nodeName).toBe('svg')
rerender(<LinkIcon type={'download'} />)
expect(container.firstChild.nodeName).toBe('svg')
rerender(<LinkIcon type={'styleguide'} />)
expect(container.firstChild.nodeName).toBe('svg')
}) })
it('does not render with unknown type', () => { it('does not render with unknown type', () => {
const link = { type: 'whatever' } const { container } = render(<LinkIcon type={'whatever'} />)
const { container } = render(<LinkIcon type={link.type} />)
expect(container.firstChild).not.toBeInTheDocument() expect(container.firstChild).not.toBeInTheDocument()
}) })
}) })