Skip to content

Instantly share code, notes, and snippets.

@schuchard
Created August 2, 2018 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schuchard/7c8ac28fe4eaeebeea2f60e9fe3cb5b2 to your computer and use it in GitHub Desktop.
Save schuchard/7c8ac28fe4eaeebeea2f60e9fe3cb5b2 to your computer and use it in GitHub Desktop.
snippets for Typescript development & testing
{
"Import module": {
"prefix": "im",
"body": "import { $2 } from '$1';",
"description": "Import module from location"
},
"Print to console": {
"prefix": "con",
"body": "console.log('${label} -> ', ${label});",
"description": "Log output to console"
},
"Track time": {
"prefix": "time",
"body": [
"console.time('${label}');",
"console.log('${label} -> ', ${label});",
"console.timeEnd(\"${label}');"
],
"description": "Track the time of a function"
},
// Testing
"Describe block": {
"prefix": "des",
"body": [
"describe('$1', () => {",
"$2",
"});"
],
"description": "Describe testing block"
},
"It block": {
"prefix": "it",
"body": [
"it('should $1', () => {",
"$2",
"});"
],
"description": "Create It block"
},
"BeforeEach": {
"prefix": "bef",
"body": [
"beforeEach(() => {",
"$1",
"});"
],
"description": "Create beforeEach body"
},
"Test expectation": {
"prefix": "ex",
"body": [
"expect($1).toEqual($2);"
],
"description": "Create test expectation body"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment