guilhermejcgois / atom-jasmine-snippets

Jasmine snippets for Atom (https://atom.io/).

Home Page:https://atom.io/packages/jasmine-snippets

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Jasmine snippets for Atom

This is a collection of jasmine statements common in my day by day.

Found some typo? Miss something else cool? Let me now or make a pull request!

Install

apm install jasmine-snippets

Supported languages

  • JavaScript
  • Python
  • Ruby
  • TypeScript

Snippets

Below I list all the available snippet's prefix. I'm not will cover what they produces, 'cause will only be a copy-paste from .cson files.

Custom

custom_equality (.ts only)

var myCustomEquality = function(first, second) {
  // return true or false if first and second are comparable,
  // otherwise, doesn't return nothig.
};

beforeEach(function () {
  jasmine.addCustomEqualityTester(myCustomEquality);
});

custom_matcher (.ts only)

var customMatchers = {
  toBeCompared: function (util, curstomEqualityTester) {
    return  {
      compare: function (actual, expected) {
        ...[negative]C[negative]C
        var result = {};

        // Assign result.pass to true or false, and result.message to some string

        return result;
      }
    }
  };
  ...
};

beforeEach(function () {
  jasmine.addCustomEqualityTester(customMatchers);
});

Globals

afterAll (.js and .ts only)

afterAll

afterEach (.js and .ts only)

afterEach

beforeAll (.js and .ts only)

beforeAll

beforeEach (.js and .ts only)

beforeEach

describe (.js and .ts only)

describe

expect (.js and .ts only)

expect

fdescribe (.js and .ts only)

fdescribe

fit (.js and .ts only)

fit

it (.js and .ts only)

it

pending (.js and .ts only)

pend

spyOn (.js and .ts only)

spyOn

xdescribe (.js and .ts only)

xdescribe

xit (.js and .ts only)

xit

Matchers

nothing (.js and .ts only)

exp-n

toBe (.js and .ts only)

exp-tb

toBeCloseTo (.js and .ts only)

exp-tbct

toBeCloseTo (with precision) (.js and .ts only)

exp-tbctp

toBeDefined (.js and .ts only)

exp-tbd

toBeFalsy (.js and .ts only)

exp-tbf

toBeGreaterThan (.js and .ts only)

exp-tbgt

toBeGreaterThanOrEqual (.js and .ts only)

exp-tbgtoe

toBeLessThan (.js and .ts only)

exp-tblt

toBeLessThanOrEqual (.js and .ts only)

exp-tbltoe

toBeNan (.js and .ts only)

exp-nan

toBeNegativeInfinity (.js and .ts only)

exp-ninf

toBeNull (.js and .ts only)

exp-null

toBePositiveInfinity (.js and .ts only)

exp-inf

toBeTruthy (.js and .ts only)

exp-tbt

toBeUndefined (.js and .ts only)

exp-tbud

toContain (.js and .ts only)

exp-tc

toEqual (.js and .ts only)

exp-teq

toHaveBeenCalled (.js and .ts only)

exp-thbc

toHaveBeenCalledBefore (.js and .ts only)

exp-thbcb

toHaveBeenCalledTimes (.js and .ts only)

exp-thbct

toHaveBeenCalledWith (.js and .ts only)

exp-thbcw

toMatch (.js and .ts only)

exp-tm

Spys

createSpy (.js and .ts only)

jasm-spy

createSpyObj (.js and .ts only)

jasm-spyobj  // for only one method
jasm-spyobjs // for multiple methods

and.callFake (.js and .ts only)

jasm-fake

and.callThrough (.js and .ts only)

jasm-through

and.returnValue (.js and .ts only)

jasm-retValue

and.returnValues (.js and .ts only)

jasm-retValues

and.throwError (.js and .ts only)

jasm-error

About

Jasmine snippets for Atom (https://atom.io/).

https://atom.io/packages/jasmine-snippets

License:MIT License