Skip to content

Instantly share code, notes, and snippets.

@malys
Last active November 30, 2017 09:53
Show Gist options
  • Save malys/6f8bf797b00bf19979fd to your computer and use it in GitHub Desktop.
Save malys/6f8bf797b00bf19979fd to your computer and use it in GitHub Desktop.
[Jasmine Snippets] #javascript #jasmine
[
{
"name":"After Each",
"trigger":"Jaft",
"usage":"Jaft",
"inline":true,
"description":"Jasmine After Each",
"template":"afterEach (function(){\n$${body}\n{\n"
},
{
"name":"Any",
"trigger":"Jany",
"usage":"Jany",
"inline":true,
"description":"Jasmine any",
"template":"jasmine.any($${1})"
},
{
"name":" Before Each",
"trigger":"Jbef",
"usage":"Jbef",
"inline":true,
"description":"Jasmine Before Each",
"template":"beforeEach(function(){\n$${body}\n});"
},
{
"name":"Describe",
"trigger":"Jdes",
"usage":"Jdes",
"inline":true,
"description":"Jasmine Describe",
"template":"describe(\\'$${description}\\', function(){\n!!{cursor}\n});"
},
{
"name":"Expect not to be defined",
"trigger":"Jnotd",
"usage":"Jnotd",
"inline":true,
"description":"Jasmine Expect not to be defined",
"template":"expect($${target}).not.toBeDefined();\n!!{cursor}"
},
{
"name":"Expect not to be falsy",
"trigger":"Jnotf",
"usage":"Jnotf",
"inline":true,
"description":"Jasmine Expect not to be falsy",
"template":"expect($${target}).not.toBeFalsy();\n!!{cursor}"
},
{
"name":"Expect not to be null",
"trigger":"Jnotn",
"usage":"Jnotn",
"inline":true,
"description":"Jasmine Expect not to be null",
"template":"expect($${target}).not.toBeNull();\n!!{cursor}"
},
{
"name":"Expect to be truthy",
"trigger":"Jnott",
"usage":"Jnott",
"inline":true,
"description":"Jasmine Expect to be truthy",
"template":"expect($${target}).not.toBeTruthy();\n!!{cursor}"
},
{
"name":"Expect not to contain",
"trigger":"Jnotc",
"usage":"Jnotc",
"inline":true,
"description":"Jasmine Expect not to contain",
"template":"expect($${target}).not.toContain($${value});\n!!{cursor}"
},
{
"name":"Expect not to equal",
"trigger":"Jnote",
"usage":"Jnote",
"inline":true,
"description":"Jasmine Expect not to equal",
"template":"expect($${target}).not.toEqual($${value});\n!!{cursor}"
},
{
"name":"Expect not to match",
"trigger":"Jnotm",
"usage":"Jnotm",
"inline":true,
"description":"Jasmine Expect not to match",
"template":"expect($${target}).not.toBeDefined();\n!!{cursor}"
},
{
"name":"Expect not",
"trigger":"Jnotx",
"usage":"Jnotx",
"inline":true,
"description":"Jasmine Expect not",
"template":"expect($${target}).not;\n!!{cursor}"
},
{
"name":"Expect to be defined",
"trigger":"Jed",
"usage":"Jed",
"inline":true,
"description":"Jasmine Expect to be defined",
"template":"expect($${target}).toBeDefined();\n!!{cursor}"
},
{
"name":"Expect to be falsy",
"trigger":"Jef",
"usage":"Jef",
"inline":true,
"description":"Jasmine Expect to be falsy",
"template":"expect($${target}).toBeFalsy();\n!!{cursor}"
},
{
"name":"Expect to be null",
"trigger":"Jen",
"usage":"Jen",
"inline":true,
"description":"Jasmine Expect to be null",
"template":"expect($${target}).toBeNull();\n!!{cursor}"
},
{
"name":"Expect to be truthy",
"trigger":"Jet",
"usage":"Jet",
"inline":true,
"description":"Jasmine Expect to be truthy",
"template":"expect($${target}).toBeTruthy();\n!!{cursor}"
},
{
"name":"Expect to contain",
"trigger":"Jec",
"usage":"Jec",
"inline":true,
"description":"Jasmine Expect to contain",
"template":"expect($${target}).toContain($${value});\n!!{cursor}"
},
{
"name":"Expect to equal",
"trigger":"Jee",
"usage":"Jee",
"inline":true,
"description":"Jasmine Expect to equal",
"template":"expect($${target}).toEqual($${value});\n!!{cursor}"
},
{
"name":"Expect to match",
"trigger":"Jem",
"usage":"Jem",
"inline":true,
"description":"Jasmine Expect to match",
"template":"expect($${target}).toMatch($${pattern});\n!!{cursor}"
},
{
"name":"Expect was called with",
"trigger":"Jescw",
"usage":"Jescw",
"inline":true,
"description":"Jasmine Expect was called with",
"template":"expect($${target}).wasCalledWith($${arguments});\n!!{cursor}"
},
{
"name":"Expect was called",
"trigger":"Jesc",
"usage":"Jesc",
"inline":true,
"description":"Jasmine Expect was called",
"template":"expect($${target}).wasCalled();\n!!{cursor}"
},
{
"name":"Expect was not called with",
"trigger":"Jnotscw",
"usage":"Jnotscw",
"inline":true,
"description":"Jasmine Expect was not called with",
"template":"expect($${target}).wasNotCalledWith($${arguments});\n!!{cursor}"
},
{
"name":"Expect was not called",
"trigger":"Jnotsc",
"usage":"Jnotsc",
"inline":true,
"description":"Jasmine Expect was not called",
"template":"expect($${target}).wasNotCalled();\n!!{cursor}"
},
{
"name":"Expect",
"trigger":"Jex",
"usage":"Jex",
"inline":true,
"description":"Jasmine Expect",
"template":"expect($${target});\n!!{cursor}"
},
{
"name":"It",
"trigger":"Jit",
"usage":"Jit",
"inline":true,
"description":"Jasmine It",
"template":"it(\\'$${description}\\', function() {\n!!{cursor}\n});\n!!{cursor}"
},
{
"name":"Runs",
"trigger":"Jru",
"usage":"Jru",
"inline":true,
"description":"Jasmine Runs",
"template":"runs(function(){$${body}\n});"
},
{
"name":"Spy on and call fake",
"trigger":"Jscf",
"usage":"Jscf",
"inline":true,
"description":"Jasmine Spy on and call fake",
"template":"spyOn($${object},\n\\'$${method}\\').andCallFake($${function});\n!!{cursor}"
},
{
"name":"Spy on and call through",
"trigger":"Jsct",
"usage":"Jsct",
"inline":true,
"description":"Jasmine Spy on and call through",
"template":"spyOn($${object},\n\\'$${method}\\').andCallThrough();\n!!{cursor}"
},
{
"name":"Spy on and return",
"trigger":"Jsr",
"usage":"Jsr",
"inline":true,
"description":"Jasmine Spy on and retur",
"template":"spyOn($${object},\n\\'$${method}\\').andReturn($${3:arguments});\n!!{cursor}"
},
{
"name":"Spy on and throw",
"trigger":"Jst",
"usage":"Jst",
"inline":true,
"description":"Jasmine py on and throw",
"template":"spyOn($${object},\n\\'$${method}\\').andThrow($${exception});\n!!{cursor}"
},
{
"name":"Spy on",
"trigger":"Js",
"usage":"Js",
"inline":true,
"description":"Jasmine Spy on",
"template":"spyOn($${object},\n\\'$${method}\\');\n!!{cursor}"
},
{
"name":"Waits",
"trigger":"Jwa",
"usage":"Jwa",
"inline":true,
"description":"Jasmine Waits",
"template":"waits($${1});\n!!{cursor}"
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment