Skip to content

A collection of stubs to ease unit-testing of Parse.js based applications.

License

Notifications You must be signed in to change notification settings

dziamid/parse-mock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

Parse Mock

Important notice

This repo is not maintained. Please use any of these instead:

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
  }));


});


About

A collection of stubs to ease unit-testing of Parse.js based applications.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published