1.1.4 • Published 10 years ago

parse-mock v1.1.4

Weekly downloads
11
License
MIT
Repository
github
Last release
10 years ago

Build Status

Parse Mock

A collection of stubs to ease unit-testing of Parse.com services.

  • Seamless Parse integration. New Mock Object
  • Use with any testing framework
  • Only sinon as a dependency

Brought to you by the DashBouquet team.

Installation

npm install parse-mock --save-dev

Usage

//karma.conf.js

module.exports = function (config) {
  'use strict';
  config.set({
    basePath: '',
    frameworks: ['jasmine', 'sinon'],
    files: [
      'your/app/build.js',
      'src/vendor/parse-mock.js',
      'your/app/**/*.spec.js'
    ],
    browsers: ['Chrome']
  });
};
//sample.spec.js
describe('My parsejs app', function () {

  it('should load some data from parse', function () {
    var stub = Parse.Mock.stubQueryFind(function (options) {
      return [new Parse.Object('User', {name: 'Antony'})]
    });

    expect(getUser()).toBeUndefined();

    loadUser(); //function that invokes Query.find

    expect(getUser()).toBeDefined();
    expect(stub.callCount).toEqual(1); //do assertions on stub object if necessary
  }));

  afterEach(inject(function () {
    Parse.Mock.clearStubs(); //manually dispose of stubs
  }));


});
1.1.4

10 years ago

1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago