CVarisco/create-component-app

View on GitHub
src/defaultTemplates/js/__tests__/class.template.test.js

Summary

Maintainability
A
0 mins
Test Coverage
import template from '../class.template'

const options = {
  cssExtension: '',
  styleFileName: 'Foo',
}

describe('Class Template', () => {
  it('should a string', () => {
    expect(typeof template('Foo', 'stateless', options)).toBe('string')
  })

  it('should have class with component name', () => {
    expect(template('Foo', 'class', options)).toContain(
      'class Foo extends Component'
    )
  })

  it('should extend component with propTypes', () => {
    expect(template('Foo', 'class', options)).toContain('Foo.propTypes')
  })

  it('should extend component with defaultProps', () => {
    expect(template('Foo', 'class', options)).toContain('Foo.defaultProps')
  })

  it('should export component', () => {
    expect(template('Foo', 'class', options)).toContain('export default Foo')
  })
})