Skip to content

Instantly share code, notes, and snippets.

@jeffschwartz
Created July 12, 2015 21:50
Show Gist options
  • Select an option

  • Save jeffschwartz/18cd94ca66278655fe24 to your computer and use it in GitHub Desktop.

Select an option

Save jeffschwartz/18cd94ca66278655fe24 to your computer and use it in GitHub Desktop.
Preamble snippets for the fabulous Atom editor
'.source.js':
'Preamble configure':
'prefix': 'configure'
'body': """
configure({
$1: $2,
});
"""
'Preamble describe':
'prefix': 'describe'
'body': """
describe('$1', function(){
$2
});
"""
'Preamble beforeEach':
'prefix': 'beforeEach'
'body': """
beforeEach(function($1){
$2
});
"""
'Preamble afterEach':
'prefix': 'afterEach'
'body': """
afterEach(function($1){
$2
});
"""
'Preamble it':
'prefix': 'it'
'body': """
it('$1', function($2){
$4
}, ${3:0});
"""
'Preamble expect':
'prefix': 'expect'
'body': 'expect($1).$2'
'Preamble not':
'prefix': 'not'
'body': 'not.$1'
'Preamble toEqual':
'prefix': 'toEqual'
'body': 'toEqual($1);$2'
'Preamble toBeTrue':
'prefix': 'toBeTrue'
'body': 'toBeTrue();$1'
'Preamble toBeTruthy':
'prefix': 'toBeTruthy'
'body': 'toBeTruthy();$1'
'Preamble toHaveBeenCalled':
'prefix': 'toHaveBeenCalled'
'body': 'toHaveBeenCalled();$1'
'Preamble toHaveBeenCalledWith':
'prefix': 'toHaveBeenCalledWith'
'body': 'toHaveBeenCalledWith($1);$2'
'Preamble toHaveBeenCalledWithContext':
'prefix': 'toHaveBeenCalledWithContext'
'body': 'toHaveBeenCalledWithContext($1);$2'
'Preamble toHaveReturned':
'prefix': 'toHaveReturned'
'body': 'toHaveReturned($1);$2'
'Preamble toHaveThrown':
'prefix': 'toHaveThrown'
'body': 'toHaveThrown($1);$2'
'Preamble toHaveThrownWithMessage':
'prefix': 'toHaveThrownWithMessage'
'body': 'toHaveThrownWithMessage($1);$2'
'Preamble toHaveThrownWithName':
'prefix': 'toHaveThrownWithName'
'body': 'toHaveThrownWithName($1);$2'
'Preamble spyOn':
'prefix': 'spyOn'
'body': 'spyOn($1, $2)$3'
'Preamble spyOn.x':
'prefix': 'spyOn.x'
'body': 'spyOn.x($1, [\'$2\',$3])$4'
'Preamble calls.count':
'prefix': 'calls.count'
'body': 'calls.count()'
'Preamble calls.forCall':
'prefix': 'calls.forCall'
'body': 'calls.forCall($1)'
'Preamble calls.all':
'prefix': 'calls.all'
'body': 'calls.all()'
'Preamble calls.wasCalledWith':
'prefix': 'calls.wasCalledWith'
'body': 'calls.wasCalledWith($1)'
'Preamble calls.wasCalledWithContext':
'prefix': 'calls.wasCalledWithContext'
'body': 'calls.wasCalledWithContext($1)'
'Preamble calls.returned':
'prefix': 'calls.returned'
'body': 'calls.returned($1)'
'Preamble calls.threw':
'prefix': 'calls.threw'
'body': 'calls.threw()'
'Preamble calls.threwWithMessage':
'prefix': 'calls.threwWithMessage'
'body': 'calls.threwWithMessage($1)'
'Preamble calls.threwWithName':
'prefix': 'calls.threwWithName'
'body': 'calls.threwWithName($1)'
'Preamble reset':
'prefix': 'reset'
'body': 'reset();$1'
'Preamble getContext':
'prefix': 'getContext'
'body': 'getContext()'
'Preamble getArgs':
'prefix': 'getArgs'
'body': 'getArgs()'
'Preamble getArg':
'prefix': 'getArg'
'body': 'getArg($1)'
'Preamble getArgsLength':
'prefix': 'getArgsLength'
'body': 'getArgsLength()'
'Preamble getArgProperty':
'prefix': 'getArgProperty'
'body': 'getArgProperty($1, \'$2\')'
'Preamble hasArgProperty':
'prefix': 'hasArgProperty'
'body': 'hasArgProperty($1, \'$2\')'
'Preamble hasArg':
'prefix': 'hasArg'
'body': 'hasArg($1)'
'Preamble getError':
'prefix': 'getError'
'body': 'getError()'
'Preamble getReturned':
'prefix': 'getReturned'
'body': 'getReturned()'
'Preamble getLength':
'prefix': 'getLength'
'body': 'getLength()'
'Preamble and.callWithContext':
'prefix': 'and.callWithContext'
'body': 'and.callWithContext($1)'
'Preamble and.throw':
'prefix': 'and.throw'
'body': 'and.throw()'
'Preamble and.throwWithMessage':
'prefix': 'and.throwWithMessage'
'body': 'and.throwWithMessage($1)'
'Preamble and.throwWithName':
'prefix': 'and.throwWithName'
'body': 'and.throwWithName($1)'
'Preamble and.return':
'prefix': 'and.return'
'body': 'and.return($1)'
'Preamble and.callActual':
'prefix': 'and.callActual'
'body': 'and.callActual()'
'Preamble and.callFake':
'prefix': 'and.callFake'
'body': 'and.callFake()'
'Preamble and.expect.it.toBeCalled':
'prefix': 'and.expect.it.toBeCalled'
'body': 'and.expect.it.toBeCalled()'
'Preamble and.expect.it.toBeCalledWith':
'prefix': 'and.expect.it.toBeCalledWith'
'body': 'and.expect.it.toBeCalledWith($1)'
'Preamble and.expect.it.toBeCalledWithContext':
'prefix': 'and.expect.it.toBeCalledWithContext'
'body': 'and.expect.it.toBeCalledWithContext($1)'
'Preamble and.expect.it.toReturn':
'prefix': 'and.expect.it.toReturn'
'body': 'and.expect.it.toReturn($1)'
'Preamble and.expect.it.toThrow':
'prefix': 'and.expect.it.toThrow'
'body': 'and.expect.it.toThrow()'
'Preamble and.expect.it.toThrowWithName':
'prefix': 'and.expect.it.toThrowWithName'
'body': 'and.expect.it.toThrowWithName(\'$1\')'
'Preamble and.expect.it.toThrowWithMessage':
'prefix': 'and.expect.it.toThrowWithMessage'
'body': 'and.expect.it.toThrowWithMessage(\'$1\')'
'Preamble validate':
'prefix': 'validate'
'body': 'validate();$1'
'Preamble getUiTestContainerElement':
'prefix': 'getUiTestContainerElement'
'body': 'getUiTestContainerElement();$1'
'Preamble getUiTestContainerElementId':
'prefix': 'getUiTestContainerElementId'
'body': 'getUiTestContainerElementId();$1'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment