Skip to content

Commit f7b2d6f

Browse files
committed
break down a test to 3 component tests
1 parent 0ac7c8a commit f7b2d6f

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,18 @@ describe("tally()", () => {
2323
// Given an array with duplicate items
2424
// When passed to tally
2525
// Then it should return counts for each unique item
26-
describe("when given an array with duplicate items", () => {
27-
test("should return an object with counts for each unique item", () => {
26+
describe("when given an array with a single item", () => {
27+
test("should return an object with counts for that item (1)", () => {
2828
expect(tally(["a"])).toEqual({ a: 1 });
29+
});
30+
});
31+
describe("when given an array with duplicate items", () => {
32+
test("should return an object with counts that item", () => {
2933
expect(tally(["a", "a", "a"])).toEqual({ a: 3 });
34+
});
35+
});
36+
describe("when given an array with duplicate items", () => {
37+
test("should return an object with counts for each unique item", () => {
3038
expect(tally(["a", "a", "b", "c"])).toEqual({ a: 2, b: 1, c: 1 });
3139
});
3240
});

0 commit comments

Comments
 (0)