Last active
July 18, 2018 15:11
-
-
Save Bamblehorse/9e1a4d570d60f8f738589fb9cb42ca0b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const templates = { | |
index: name => `// @flow | |
import React from 'react'; | |
import './${name}.css'; | |
// TODO: write rest of ${name} component | |
const ${name} = () => ( | |
<div className="${name.toLowerCase()}"> | |
<span>rest of component</span> | |
</div> | |
); | |
export default ${name};`, | |
test: name => `// TODO: TDD | |
import { shallow, render } from 'enzyme'; | |
import renderer from 'react-test-renderer'; | |
import React from 'react'; | |
import ${name} from '.'; | |
const component = <${name} />; | |
describe('The ${name} component', () => { | |
it('renders correctly', () => { | |
const wrapper = render(component); | |
expect(wrapper.hasClass('${name.toLowerCase()}')).toBeTruthy(); | |
const tree = renderer.create(component).toJSON(); | |
expect(tree).toMatchSnapshot(); | |
}); | |
});`, | |
sass: name => `.${name.toLowerCase()} | |
background: initial`, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment