deptest
v1.0.0
Published
depject plugin for tests
Downloads
3
Readme
deptest
depject plugin for tests
Give tests from your depject modules.
Usage
const combine = require('depject')
const {first} = require('depject/apply')
const deptest = require('deptest')
const tests = {
gives: 'tests',
create: function (api) {
return function (tests) {
tests['addition'] = function (assert, cb) {
assert(1 + 1 === 2)
cb()
}
tests['async maths'] = function (assert, cb) {
setTimeout(() => {
assert(1 + 1 === 2)
cb()
}, 300)
}
return tests
}
}
}
//lines below would normally be in test.js or similar
//combine your tests with your other modules
const modules = combine([tests, deptest])
//Run the tests!
first(modules.test)()
outputs
✔ addition
✔ async maths
API
Needs
exports.needs = nest({
'tests': 'reduce'
})
Gives
exports.gives = nest({
'test'
})
Giving tests
functions
You give tests
functions from your modules that have the shape:
(tests) => tests
Where tests is an object that has shape:
{
'my test name': (assert, cb) =>{}
}
Install
With npm installed, run
$ npm install deptest
See Also
License
MIT