Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Mocking and stubbing in JavaScript.
Branch: master
Pull request Compare This branch is 67 commits behind Manfred:master.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
javascripts
stylesheets
README
index.html

README

Moksi
-----

Moksi is a stubbing and mocking library for JavaScript.

  var Person {
    name: function() {
      return 'Alice';
    },
    age: function() {
      return 28;
    }
  }
  
  // Stub the person's name.
  Moksi.stub(Person, 'name', function(){
    return 'Bob';
  });
  Person.name() == 'Bob';
  
  // Expect age to be called
  Moksi.expects(Person, 'age');
  Person.age();
  Moksi.assertExpectations(this);
  
  // Revert all stubs and expectations
  Moksi.revert(); 
  Person.name() == 'Alice';
Something went wrong with that request. Please try again.