Skip to content

Commit fca3dde

Browse files
author
JorvanW
committed
removed errors in the lookup.js code and updated the test to function properly
1 parent f6cf1e1 commit fca3dde

2 files changed

Lines changed: 14 additions & 15 deletions

File tree

‎Sprint-2/implement/lookup.js‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
11
function createLookup(countryCurrencyPairs) {
22
const lookup = {};
33

4-
countryCurrencyPairs.forEach(pair => {
4+
countryCurrencyPairs.forEach((pair) => {
55
lookup[pair[0]] = pair[1];
66
});
77

88
return lookup;
99
}
1010

11-
const countryCurrencyPairs = [
12-
['US', 'USD'],
13-
['CA', 'CAD'],
14-
['EN', 'GBP']
15-
];
16-
17-
18-
19-
2011
module.exports = createLookup;

‎Sprint-2/implement/lookup.test.js‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
const createLookup = require("./lookup.js");
22

3-
test("creates a country currency code lookup for multiple codes",() => {
4-
expect(createLookup(countryCurrencyPairs)).toEqual([[US, 'USD'], [CA, 'CAD'], [EN, 'GBP']]);
5-
})
3+
test("creates a country currency code lookup for multiple codes", () => {
4+
const countryCurrencyPairs = [
5+
["US", "USD"],
6+
["CA", "CAD"],
7+
["EN", "GBP"],
8+
];
9+
10+
expect(createLookup(countryCurrencyPairs)).toEqual({
11+
US: "USD",
12+
CA: "CAD",
13+
EN: "GBP",
14+
});
15+
});
616

717
/*
818
@@ -35,5 +45,3 @@ It should return:
3545
'CA': 'CAD'
3646
}
3747
*/
38-
39-

0 commit comments

Comments
 (0)