Skip to content

Commit

Permalink
Merge pull request #59 from josemoracard/jose2-00-welcome
Browse files Browse the repository at this point in the history
added solution files
  • Loading branch information
tommygonzaleza authored Oct 25, 2023
2 parents 52a14f4 + bba2140 commit 5bf7882
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
16 changes: 16 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const fromEuroToDollar = function(valueInEuro) {
let valueInDollar = valueInEuro * 1.07;
return valueInDollar;
}

const fromDollarToYen = function(valueInDollar) {
let valueInYen = valueInDollar * 149.03;
return valueInYen;
}

const fromYenToPound = function(valueInYen) {
let valueInPound = valueInYen * 0.0072;
return valueInPound;
}

module.exports = { fromEuroToDollar, fromDollarToYen, fromYenToPound };
17 changes: 17 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
test("One euro should be 1.07 dollars", function() {
// Import the function from app.js
const { fromEuroToDollar } = require('./app.js');
expect(fromEuroToDollar(3.5)).toBe(3.745);
})

test("Conversion from USD to JPY (1 USD = 149.03 JPY)", function() {
// Import the function from app.js
const { fromDollarToYen } = require('./app.js')
expect(fromDollarToYen(10)).toBe(1490.3);
})

test("Conversion from JPY to GBP (1 JPY = 0.0072 GBP)", function() {
// Import the function from app.js
const { fromYenToPound } = require('./app.js')
expect(fromYenToPound(1000)).toBe(7.2);
})

0 comments on commit 5bf7882

Please sign in to comment.