-
Notifications
You must be signed in to change notification settings - Fork 0
Jasmine TDD
tdkehoe edited this page Sep 11, 2015
·
23 revisions
Set the directory:
spec/spec.js
app.js
#spec.js app.js is an object of keys and methods. The name of the object is module.exports.
module.exports = {
nameOfTest: function() {
// code goes here;
return anyName;
},
anotherTest: function() {
// more code;
// return somethingElse;
}
};
#spec.js In spec.js:
var app = require('./../app.js');
var inputData = ['red', 'green', 'blue'];
describe('Test nameOfTest', function() {
it('Description of code', function() {
expect(app.nameOfTest(inputData)).toEqual(outputData);
});
});
var moreInputData = [...]
describe('Test anotherTest', function() {
it('Description of code', function() {
expect(app.nameOfOtherTest(moreInputData)).toEqual(outputData);
});
});
#Run jasmine
Run the tests from the root directory with the command
jasmine