New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ember-cli-jsmockito

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-cli-jsmockito

Javascript mocking library for unit testing ember-cli code

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

Ember-cli-jsmockito

Javascript Mocking and Matching Library for unit testing ember-cli applications.

Requirements

ember-cli >= 0.1.4

Installing

npm install ember-cli-jsmockito --save-dev

Add the following to tests/.jshintrc inside the predef array.

    "mock",
    "when",
    "verify",
    "mockFunction",
    "spy",
    "verifyZeroInteractions",
    "verifyNoMoreInteractions",
    "isMock",
    "never",
    "zeroInteractions",
    "noMoreInteractions",
    "times",
    "once",
    "empty",
    "everyItem",
    "hasItem",
    "hasItems",
    "hasSize",
    "isIn",
    "oneOf",
    "allOf",
    "anyOf",
    "anything",
    "both",
    "either",
    "equalTo",
    "is",
    "nil",
    "not",
    "raises",
    "raisesAnything",
    "sameAs",
    "truth",
    "equivalentMap",
    "equivalentArray",
    "between",
    "closeTo",
    "divisibleBy",
    "even",
    "greaterThan",
    "greaterThanOrEqualTo",
    "lessThan",
    "lessThanOrEqualTo",
    "notANumber",
    "odd",
    "zero",
    "bool",
    "func",
    "hasFunction",
    "hasMember",
    "instanceOf",
    "number",
    "object",
    "string",
    "typeOf",
    "containsString",
    "emailAddress",
    "endsWith",
    "equalIgnoringCase",
    "matches",
    "startsWith"

Features

Rich and readable matching api - docs

assertThat('', empty());
assertThat('user@domain.com', emailAddress());
assertThat(10, either(greaterThan(50)).or(even()));
assertThat([1,2,3], everyItem(greaterThan(0)));
assertThat([1,2,3], hasSize(lessThan(5)));

Mock any object - docs

var modelMock = mock(DS.Model);
var controllerMock = mock(Ember.Controller);

Mock functions - docs

var mockedFunc = mockFunction();

Setup expectations on your mocks - docs

var employeeMock = mock(DS.Model);
when(employeeMock).get('name').thenReturn('jack');
equal('jack',employeeMock.get('name'));

Verify function execution - docs

var mockedFunc = mockFunction();
mockedFunc('hello world');
verify(mockedFunc)('hello world');
  • Visit JsMockito for more information about mocking.
  • Visit JsHamcrest for more information about the matching.

Keywords

ember-addon

FAQs

Package last updated on 11 Dec 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts