Skip to content

Commit 25e5aff

Browse files
author
JorvanW
committed
added more test cases for lookup.test and test involving various currency pairs
1 parent ec4725c commit 25e5aff

1 file changed

Lines changed: 31 additions & 1 deletion

File tree

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

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

3-
test("creates a country currency code lookup for multiple codes", () => {
3+
test("creates a lookup from one country currency pair", () => {
4+
const countryCurrencyPairs = [["JP", "JPY"]];
5+
6+
expect(createLookup(countryCurrencyPairs)).toEqual({
7+
JP: "JPY",
8+
});
9+
});
10+
11+
test("creates a lookup for multiple country currency pairs", () => {
412
const countryCurrencyPairs = [
513
["US", "USD"],
614
["CA", "CAD"],
@@ -14,6 +22,28 @@ test("creates a country currency code lookup for multiple codes", () => {
1422
});
1523
});
1624

25+
test("creates a lookup for a larger list of country currency pairs", () => {
26+
const countryCurrencyPairs = [
27+
["FR", "EUR"],
28+
["AU", "AUD"],
29+
["CH", "CHF"],
30+
["MX", "MXN"],
31+
["SE", "SEK"],
32+
];
33+
34+
expect(createLookup(countryCurrencyPairs)).toEqual({
35+
FR: "EUR",
36+
AU: "AUD",
37+
CH: "CHF",
38+
MX: "MXN",
39+
SE: "SEK",
40+
});
41+
});
42+
43+
test("creates an empty lookup when given an empty array", () => {
44+
expect(createLookup([])).toEqual({});
45+
});
46+
1747
/*
1848
1949
Create a lookup object of key value pairs from an array of code pairs

0 commit comments

Comments
 (0)