@toptal/davinci-code
Version:
Code generation package for frontend applications
36 lines (27 loc) • 802 B
text/troff
---
to: src/modules/<%= h.changeCase.paramCase(moduleName) %>/components/<%= h.changeCase.pascalCase(name) %>/<%= h.changeCase.pascalCase(name) %>.test.tsx
---
<%
Name = h.changeCase.pascalCase(name)
-%>
import React, { ReactNode } from 'react'
import { render, cleanup, RenderResult } from '@testing-library/react'
import <%= Name %>, { Props } from './'
const renderTest<%= Name %> = (
children: ReactNode,
props: Props
) => {
const { /* add props you need */ } = props
return render(<<%= Name %>>{children}</<%= Name %>>)
}
describe('<%= Name %>', () => {
let api: RenderResult
beforeEach(() => {
api = renderTest<%= Name %>(null, {})
})
afterEach(cleanup)
it('renders component', () => {
const { container } = api
expect(container).toMatchSnapshot()
})
})