Skip to content

Commit 4c0d767

Browse files
author
JorvanW
committed
added code to lookup.test
1 parent 663412b commit 4c0d767

2 files changed

Lines changed: 22 additions & 3 deletions

File tree

‎Sprint-2/implement/lookup.js‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
1-
function createLookup() {
2-
// implementation here
1+
function createLookup(countryCurrencyPairs) {
2+
const lookup = {};
3+
4+
countryCurrencyPairs.forEach(pair => {
5+
lookup[pair[0]] = pair[1];
6+
});
7+
8+
return lookup;
39
}
410

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

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

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

3-
test.todo("creates a country currency code lookup for multiple codes");
3+
test("creates a country currency code lookup for multiple codes",() => {
4+
expect(createLookup(countryCurrencyPairs)).toEqual([[US, 'USD'], [CA, 'CAD'], [EN, 'GBP']]);
5+
})
46

57
/*
68
@@ -33,3 +35,5 @@ It should return:
3335
'CA': 'CAD'
3436
}
3537
*/
38+
39+

0 commit comments

Comments
 (0)