Last active
September 8, 2021 14:15
-
-
Save laurazenc/c7a1ce70df729985a113ed9db8089ba7 to your computer and use it in GitHub Desktop.
VSCode snippets
This file contains hidden or 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
Show hidden characters
{ | |
"Jest suite test for components": { | |
"prefix": "test-suite-comp", | |
"body": [ | |
"import { render, screen } from '@testing-library/react'", | |
"import { ${TM_FILENAME_BASE/([^.]+).*/${1}/} } from './${TM_FILENAME_BASE/([^.]+).*/${1}/}'", | |
"", | |
"describe('${TM_FILENAME_BASE/([^.]+).*/${1}/}', () => {", | |
" it('should render', () => {", | |
" const renderInstance = render(<${TM_FILENAME_BASE/([^.]+).*/${1}/}/>)", | |
" expect(renderInstance.asFragment().firstChild).toBeTruthy()", | |
" })", | |
"})" | |
], | |
"description": "Jest file structure for react component" | |
}, | |
"Jest suite test": { | |
"prefix": "test-suite", | |
"body": [ | |
"import { ${TM_FILENAME_BASE/([^.]+).*/${1}/} } from './${TM_FILENAME_BASE/([^.]+).*/${1}/}'", | |
"", | |
"describe('${TM_FILENAME_BASE/([^.]+).*/${1}/}', () => {", | |
" it('should do something', () => {", | |
" expect(true).toBeTruthy()", | |
" })", | |
"})" | |
], | |
"description": "Jest file structure" | |
} | |
} |
This file contains hidden or 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
{ | |
"Create story": { | |
"prefix": "story", | |
"body": [ | |
"import { Meta, Story } from '@storybook/react'", | |
"import { ${TM_FILENAME_BASE/([^.]+).*/${1}/} } from './${TM_FILENAME_BASE/([^.]+).*/${1}/}'", | |
"", | |
"export default {", | |
" title: '${2}/${TM_FILENAME_BASE/([^.]+).*/${1}/}',", | |
" component: ${TM_FILENAME_BASE/([^.]+).*/${1}/},", | |
" parameters: {", | |
" controls: {", | |
" sort: 'alpha',", | |
" exclude: ['spTheme'],", | |
" },", | |
" docs: { source: { excludeDecorators: true } },", | |
" design: {", | |
" url: 'design url here',", | |
" },", | |
"},", | |
"} as Meta", | |
"", | |
"const Template: Story = (props: ${TM_FILENAME_BASE/([^.]+).*/${1}/}Props) => <${TM_FILENAME_BASE/([^.]+).*/${1}/} {...props}></${TM_FILENAME_BASE/([^.]+).*/${1}/}>", | |
"", | |
"export const Default = Template.bind({})", | |
"Default.args = {}" | |
], | |
"description": "Storybook file structure" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment