// test > sum function
// # sum(1, 2) == 3 (returns the sum of both params)
// # sum(3, 4) == 7 (returns the sum of both params)
function sum(a, b) {
return a + b;
};
From within your project directory run:
~ $ npm install speckjs --save
Require speckjs from within your project files:
var speck = require('speckjs');
speck.build(file, option);
var test = require('tape');
var file = require('./yourFile.js');
test('sum function', function(t) {
t.plan(1);
t.equal(3, file.sum(1,2), 'returns the sum of both params');
t.equal(7, file.sum(3,4), 'returns the sum of both params');
});
This example shows a Tape test. SpeckJS compiles tests for Tape, Jasmine, and Mocha/Chai.
Check the documentation on github.com/speckjs/speckjs for more information