Skip to content

Commit 2ab0492

Browse files
committed
add test case for numbers only
1 parent 7bc6baa commit 2ab0492

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Sprint-2/implement/tally.test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,8 @@ test("given invalid input like a string, throw error", () => {
4444
test("elements of the list must be string or number, or throw error", () => {
4545
expect(() => tally([{ a: 12 }, { b: "c" }, { a: 12 }])).toThrow();
4646
});
47+
48+
// given arr of numbers, returns correct tally
49+
test("accepts numbers as elements", () => {
50+
expect(tally([1, 1, 2])).toEqual({ 1: 2, 2: 1 });
51+
});

0 commit comments

Comments
 (0)