Skip to content

Instantly share code, notes, and snippets.

@schalkneethling
Last active May 29, 2020 11:11
Show Gist options
  • Save schalkneethling/7131c494b810740cdc1283898c3795d7 to your computer and use it in GitHub Desktop.
Save schalkneethling/7131c494b810740cdc1283898c3795d7 to your computer and use it in GitHub Desktop.
VSCode JavaScript User Snippets
{
"describe block": {
"prefix": "describe",
"body": [
"describe('$1', () => {",
"",
" it('$2', () => {",
" $3",
" expect(data).toBe('{}');",
" });",
"});"
],
"Adds a decribe block for tests"
},
"async describe block": {
"prefix": "describe-async",
"body": [
"describe('$1', () => {",
"",
" it('$2', async () => {",
" $3",
" expect(data).toBe('{}');",
" });",
"});"
],
"Adds an async decribe block for tests"
},
"mock-fs describe block": {
"prefix": "describe-mockfs",
"body": [
"describe('$1', () => {",
" afterEach(() => {",
" mock.restore();",
" });",
"",
" it('$2', () => {",
" $3",
" expect(data).toBe('{}');",
" });",
"});"
],
"Adds a decribe block with mock-fs restore for tests with mock-fs filesystem"
},
"async mock-fs describe block": {
"prefix": "describe-mockfs-async",
"body": [
"describe('$1', () => {",
" afterEach(() => {",
" mock.restore();",
" });",
"",
" it('$2', async () => {",
" $3",
" expect(data).toBe('{}');",
" });",
"});"
],
"Adds an async decribe block with mock-fs restore for tests with mock-fs filesystem"
},
"it block": {
"prefix": "it-block",
"body": [
"it('$1', () => {",
" expect('').toBe('');",
"});"
],
"Adds an it() function block"
},
"async it block": {
"prefix": "it-async-block",
"body": [
"it('$1', async () => {",
" expect('').toBe('');",
"});"
],
"Adds an async it() function block"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment