Skip to content

Instantly share code, notes, and snippets.

@Bamblehorse
Last active July 18, 2018 15:11
Show Gist options
  • Save Bamblehorse/9e1a4d570d60f8f738589fb9cb42ca0b to your computer and use it in GitHub Desktop.
Save Bamblehorse/9e1a4d570d60f8f738589fb9cb42ca0b to your computer and use it in GitHub Desktop.
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