Skip to content

Instantly share code, notes, and snippets.

@msecret
Created September 14, 2016 19:27
Show Gist options
  • Save msecret/6d9022fd47438cd75e094ae20d80bfba to your computer and use it in GitHub Desktop.
Save msecret/6d9022fd47438cd75e094ae20d80bfba to your computer and use it in GitHub Desktop.
var main = require('../src/main.js');
describe('main', function() {
describe('init()', function() {
it('set the name property to the name passed in', function() {
});
});
describe('calculate()', function() {
it('should add the number to 5', function() {
var testNum = 1;
var expected = testNum + 5;
var actual = main.calculate(testNum);
assert(actual === expected);
});
it('should return nothing if you pass in non-number', function() {
var testVal = 'something';
var expected = undefined;
var actual = main.calculate(testVal);
assert(actual === expected);
});
});
});
var main = {
init: function(name) {
this.name = name;
},
calculate(num: number) {
return num + 5;
}
};
module.exports = main;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment