Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

simple stub/spy javascript library

branch: master

This branch is 0 commits ahead and 0 commits behind master

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.md

bond: the simple stub/spy javascript library

bond only provides stubbing and spy functionality. For test running and assertions, you will need to use other libraries.

the api is simple:

bond api

bond(object, 'propertyOrMethodName') returns the bond api

bond#to(value) replaces the value with a new value

bond#return(value) replaces the value with a spy that returns the given value

bond#through() replaces the value with a spy, but allows it to return its normal value

bond spies

spy.called is a call count for the spy

spy.calledWith(arg1, arg2, ...) is a test for being called with specific values

spy.calledArgs is an array of methods calls, each index holds the array of arguments for that call

usage

npm install bondjs -> bond = require 'bondjs'

<script src="bond.js"> -> window.bond(...)

tests

see the test.coffee file for examples

use npm test to run the tests

Something went wrong with that request. Please try again.