Skip to content
Snippets Groups Projects
Commit 0cd39aeb authored by Siwa Khongsuphap's avatar Siwa Khongsuphap
Browse files

Add test

parent a1f4a5f2
Branches master
No related tags found
No related merge requests found
Pipeline #349 failed
const add = (a, b) => {
return a + b;
}
const minus = (a, b) => {
return a - b;
}
module.exports = {
minus,
add,
};
\ No newline at end of file
......@@ -4,7 +4,7 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "jest"
},
"author": "",
"license": "ISC",
......
const calculator = require('../calculator')
describe('Add function', () => {
test('Should return 2 if a = 1 and b = 1', () => {
// Arrange
const a = 1;
const b = 1;
// Act
const result = calculator.add(a, b);
// Assert
expect(result).toEqual(2);
});
});
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment