Skip to content

jprichardson/stubo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stubo

stubo (pronounced stub-oh) is a simple JavaScript stubbing component. It's useful for creating stub objects for AngularJS tests or proxyquire tests.

Why not Sinon?

Sinon is a great library that supports stubbing. But unfortunately it only supports stubbing one level deep.

Installation

npm i --save stubo

Example

stubo allows you to convert this:

var stub = {
  window: {
    localStorage: {
      getItem: function () {
        return 'data'
      },
      length: 1
    }
  }
}

to this:

var stubo = require('stubo')
var stub = {}
stubo(stub, 'window', 'localStorage.getItem()', 'data')
stubo(stub, 'window', 'localStorage.length', 1)

License

MIT

About

A simple JavaScript stubbing component. Use with AngularJS or Proxyquire.

Resources

Stars

Watchers

Forks

Packages

No packages published