Commit 0cd39aeb authored by Siwa Khongsuphap's avatar Siwa Khongsuphap
Browse files

Add test

parent a1f4a5f2
Pipeline #349 failed with stages
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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment