Skip to content

Commit 3af6a3b

Browse files
authored
Implement test for country currency code lookup
1 parent d2af991 commit 3af6a3b

1 file changed

Lines changed: 18 additions & 33 deletions

File tree

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

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

3-
test.todo("creates a country currency code lookup for multiple codes");
4-
5-
/*
6-
7-
Create a lookup object of key value pairs from an array of code pairs
8-
9-
Acceptance Criteria:
10-
11-
Given
12-
- An array of arrays representing country code and currency code pairs
13-
e.g. [['US', 'USD'], ['CA', 'CAD']]
14-
15-
When
16-
- createLookup function is called with the country-currency array as an argument
17-
18-
Then
19-
- It should return an object where:
20-
- The keys are the country codes
21-
- The values are the corresponding currency codes
22-
23-
Example
24-
Given: [['US', 'USD'], ['CA', 'CAD']]
25-
26-
When
27-
createLookup(countryCurrencyPairs) is called
28-
29-
Then
30-
It should return:
31-
{
32-
'US': 'USD',
33-
'CA': 'CAD'
34-
}
35-
*/
3+
test("creates a country currency code lookup for multiple codes", () => {
4+
// Given
5+
const input = [
6+
["US", "USD"],
7+
["CA", "CAD"],
8+
];
9+
10+
const expectedOutput = {
11+
US: "USD",
12+
CA: "CAD",
13+
};
14+
15+
// When
16+
const result = createLookup(input);
17+
18+
// Then
19+
expect(result).toEqual(expectedOutput);
20+
});

0 commit comments

Comments
 (0)