|
- import * as fc from 'fast-check'
- import * as Enzyme from 'enzyme'
- import * as Axe from 'jest-axe'
- import * as React from 'react'
- import {{pascalCase name}} from './{{pascalCase name}}'
-
- it('should exist', () => {
- expect({{pascalCase name}}).toBeDefined()
- })
-
- it('should be a component', () => {
- expect({{pascalCase name}}).toBeComponent()
- })
-
- it('should render without crashing given required props', () => {
- expect(() => <{{pascalCase name}} name="" />).not.toThrow()
- })
-
- it('should guarantee minimal accessibility', () => {
- fc.assert(
- fc.asyncProperty(
- fc.string(1, 20),
- async s => {
- const wrapper = Enzyme.mount(
- <{{pascalCase name}}
- name={s}
- />
- )
- const results = await Axe.axe(wrapper.getDOMNode())
-
- expect(results).toHaveNoViolations()
- }
- )
- )
- })
-
- // TODO add more tests
|