-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from josemoracard/jose2-00-welcome
added solution files
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}) |