Skip to content

Commit

Permalink
Merge pull request #50 from FAC-Sixteen/feature/set-up-testing
Browse files Browse the repository at this point in the history
Fix/ tests #49
  • Loading branch information
Dalmano authored May 15, 2019
2 parents a2661e6 + fd4510e commit 7aaa0d5
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 24 deletions.
120 changes: 100 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"go": "nodemon src/index.js",
"test": "jest"
},
"jest": {
"testEnvironment": "node"
},
"repository": {
"type": "git",
"url": "git+https://github.com/FAC-Sixteen/GymBuddy.git"
Expand All @@ -22,6 +25,7 @@
"bcrypt": "^3.0.6",
"env2": "^2.2.2",
"express": "^4.16.4",
"express-handlebars": "^3.1.0",
"pg": "^7.11.0",
"qs": "^6.7.0"
},
Expand Down
11 changes: 11 additions & 0 deletions tests/math.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const sum = (a, b) => a + b;
const mul = (a, b) => a * b;
const sub = (a, b) => a - b;
const div = (a, b) => a / b;

module.exports = {
sum,
mul,
sub,
div
};
21 changes: 17 additions & 4 deletions tests/math.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
const sum = (a, b) => a + b;
const mul = (a, b) => a * b;
const sub = (a, b) => a - b;
const div = (a, b) => a / b;
const { sum, mul, sub, div } = require("./math");

test("Adding 1 + 1 equals 2", () => {
expect(sum(1, 1)).toBe(2);
Expand All @@ -15,3 +12,19 @@ test("Subtracting 1 - 1 equals 0", () => {
test("Dividing 1 / 1 equals 1", () => {
expect(div(1, 1)).toBe(1);
});

const fahrenheitToCelsius = temp => {
return (temp - 32) / 1.8;
};

const celsiusToFahrenheit = temp => {
return temp * 1.8 + 32;
};

test("Should convert 32 F to 0 C", () => {
expect(fahrenheitToCelsius(32)).toBe(0);
});

test("Should convert 0 C to 32 F", () => {
expect(celsiusToFahrenheit(0)).toBe(32);
});
Empty file added tests/test.env
Empty file.

0 comments on commit 7aaa0d5

Please sign in to comment.