forked from breatheco-de/exercise-unit-test-with-jest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
35 lines (22 loc) · 786 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Import the function sum from the app.js file
const { sum, fromDollarToYen, fromYenToPound, fromEuroToDollar } = require('./app.js');
// Start your first test
test('adds 14 + 9 to equal 23', () => {
// Inside the test we call our sum function with 2 numbers
let total = sum(14, 9);
expect(total).toBe(23);
});
test('convertir un dollar a yen = 146.26', () => {
let yen = fromDollarToYen(1);
expect(yen).toBe(146.26);
});
test('convertir un euro a dollar = 1.07', () => {
// Convertimos 1 euro a dólares
let dollar = fromEuroToDollar(1);
expect(dollar).toBe(1.07);
});
test('convertir un yen a pound = 0.005', () => {
// Convertimos 1 yen a libras
let pound = fromYenToPound(1);
expect(pound).toBe(0.005);
});