Skip to content

Commit 5d32052

Browse files
committed
Changes made as per the review
1 parent 466c1c5 commit 5d32052

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

Sprint-1/implement/dedupe.test.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ test("given an empty array, it returns an empty array", () => {
2323
// Given an array with no duplicates
2424
// When passed to the dedupe function
2525
// Then it should return a copy of the original array
26-
test("returns original array if there are no duplicates", () => {
27-
expect(dedupe([10, 45, 85, 20])).toEqual([10, 45, 85, 20]);
28-
expect(dedupe(["hello", "a", "hi", "b"])).toEqual(["hello", "a", "hi", "b"]);
26+
test("returns copy of the original array if there are no duplicates", () => {
27+
const input = [10, 45, 85, 20];
28+
const result = dedupe(input);
29+
expect(result).toEqual(input);
30+
expect(result).not.toBe(input);
2931
});
3032

3133
// Given an array with strings or numbers

Sprint-1/implement/max.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ test("returns the largest decimal number", () => {
5151
// Given an array with non-number values
5252
// When passed to the max function
5353
// Then it should return the max and ignore non-numeric values
54-
test("returnes max and ignores non numeric values", () => {
55-
expect(findMax(["stay", 3, "quiet", -32, 5])).toBe(5);
54+
test("returns max and ignores non number values", () => {
55+
expect(findMax(["stay", "300", "quiet", -32, 5])).toBe(5);
5656
});
5757

5858
// Given an array with only non-number values

Sprint-1/implement/sum.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ test("given an array with negative numbers, returns correct sum", () => {
3434
// When passed to the sum function
3535
// Then it should return the correct total sum
3636
test("given an array with decimal/float numbers, returns correct sum", () => {
37-
expect(sum([2.8, 4.2, 7.7])).toBe(14.7);
37+
expect(sum([2.8, 4.2, 7.7])).toBeCloseTo(14.7);
3838
});
3939
// Given an array containing non-number values
4040
// When passed to the sum function

0 commit comments

Comments
 (0)