karma-testdouble

1.0.2 • Public • Published

karma-testdouble

This package is create as a convenient helper to load testdouble.js in karma so that it doesn't have to go through a compilation step via browserify which is slow.

Installation

Install the plugin from npm:

npm install testdouble --save-dev
npm install karma-testdouble --save-dev

Add testdouble to the frameworks key in your Karma configuration:

module.exports = (config) ->
  config.set
 
    # frameworks to use 
    frameworks: ['mocha''testdouble']
 
    # ... 

Usage

You can use use td without doing an import.

For example, performAction is a function that will execute load when it is passed in:

describe('performing basic sanity checks', function () {
  it("should check if load is called", function () {
   let load = td.function('load')
    let event = {
      data: {}
    }
    performAction(event, load, {})
    td.verify(load(null))
  })
})

td.verify is used to ensure that load is executed with parameter of null.

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    204
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    204
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i karma-testdouble

Weekly Downloads

204

Version

1.0.2

License

MIT

Last publish

Collaborators

  • kahwee