1
1
mirror of https://github.com/jxnblk/mdx-deck.git synced 2024-12-02 08:03:05 +03:00
mdx-deck/test/components.js
2018-08-04 20:24:33 +02:00

23 lines
574 B
JavaScript

import React from 'react'
import { create as render } from 'react-test-renderer'
import 'jest-styled-components'
import { ThemeProvider } from 'styled-components'
import components from '../src/components'
const blacklist = {
pre: true,
img: true
}
test.each(
Object.keys(components)
.filter(key => !blacklist[key])
.map(key => {
const Component = components[key]
return [ key, <ThemeProvider theme={{}}><Component /></ThemeProvider> ]
})
)('renders %s', (name, el) => {
const json = render(el).toJSON()
expect(json).toMatchSnapshot()
})