Skip to content

Commit

Permalink
Add basic Unit Test
Browse files Browse the repository at this point in the history
  • Loading branch information
shannonlal committed Dec 12, 2019
1 parent 8742dae commit be15e3b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Sample Project for Code Coverage",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "node_modules/.bin/mocha ./test/**/*.js"
},
"keywords": [
"Node",
Expand Down
12 changes: 12 additions & 0 deletions src/multiply.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* The following function will return the multiplication of the parameters
* @param {number} a
* @param {number} b
*/
const multiply = (a,b) => {
return a*b;
}

module.exports = {
multiply
};
11 changes: 11 additions & 0 deletions test/multiply_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const assert = require('assert');

const {multiply} = require('../src/multiply');

describe('multiply example', function () {
describe('multiply', function () {
it('multplies 1 x 1', function () {
assert.equal(multiply(1, 1), 1);
});
});
});

0 comments on commit be15e3b

Please sign in to comment.