You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

ember-js-mock

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-js-mock

Ember CLI addon for JsMock (http://jsmock.org)

1.1.0
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

Ember JsMock

Build Status

Ember addon to make JsMock available as an import in your tests. JsMock is a simple mocking test framework, which can be used with any test framework. It is inspired by jMock and Sinon.js with its interface being very similar to Sinon in order to make it easy to switch between those two frameworks.

ember-js-mock was inspired by ember-sinon.

Installation

Install JsMock in your ember application using the latest Ember CLI:

$ ember install ember-js-mock

Note: ember-js-mock currently depends on ember-js-hamcrest to installed as well. This may change in the future, but for now, please run the following install command as well.

$ ember install ember-jshamcrest

Getting Started

In order to use JsMock in your tests, simply import it in your test file.

import { module, test } from 'qunit';
import JsMock from 'js-mock';

// Declare your mock only once, there is no need to copy & paste t
// his code into every test case.
var testMock;

module('Acceptance | js mock', {
  beforeEach: function () {
    JsMock.watch(function () {
      testMock = JsMock.mock("test");
    });
  },
  afterEach: function() {
    // Ensure that all expectations are fulfilled after each test case.
    JsMock.assertWatched();
  }
});

test('verify js-mock is available', function(assert) {
  testMock.once();

  testMock();

  // If there is no other assertion needed in the test method
  // then simply use `assertIfSatisfied()`.
  assert.ok(JsMock.assertWatched());
});

API Docs

The full API documentation for JsMock can be found here.

License

BSD 3-clause, see License.md

Changelog

Due to a number of NPM packaging issues (see https://github.com/npm/npm/issues/5082), the majority of the previous packages have had issues. Consequently, I am considering version 0.6.1 to be the initial release.

Major release versions will be synchronized between ember-js-mock and js-mock.

1.0.0

  • Upgraded js-mock to 1.0.0
  • Added ember-jshamcrest as a dependency as it is required by js-mock in v1

0.6.1

  • Initial release

Keywords

ember-addon

FAQs

Package last updated on 13 Jun 2016

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