Skip to content

Commit bbecf91

Browse files
committed
Improve dedupe test to ensure input is not mutated
1 parent 8bd7f4e commit bbecf91

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Sprint-1/implement/dedupe.test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,13 @@ test("given an empty array, it returns an empty array", () => {
2525
// Then it should return a copy of the original array
2626
test("given an array with no duplicates, it returns a copy of the original array", () => {
2727
const input = [1, 2, 3];
28+
const expected = [1, 2, 3];
29+
2830
const result = dedupe(input);
2931

30-
expect(result).toEqual(input);
32+
expect(result).toEqual(expected);
3133
expect(result).not.toBe(input);
34+
expect(input).toEqual([1, 2, 3]);
3235
});
3336

3437
// Given an array with strings or numbers

0 commit comments

Comments
 (0)