Skip to content

Commit ad01a87

Browse files
author
Pretty Taruvinga
committed
Fix dedupe test to prevent false positives and check input immutability
1 parent ad9af40 commit ad01a87

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Sprint-1/implement/dedupe.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ test("Given a non-array value, when passed to the dedupe function, then it shoul
3434
// Then it should return a copy of the original array
3535
test("Given an array with no duplicates, when passed to the dedupe function, then it should return a copy of the original array", () => {
3636
const input = ["a", "b", "c"];
37-
const result = dedupe(input);
37+
const copyOfInput = ["a", "b", "c"];
3838

39-
const expected = ["a", "b", "c"];
39+
const result = dedupe(input);
4040

41-
expect(result).toEqual(expected);
41+
expect(result).toEqual(copyOfInput);
4242
expect(result).not.toBe(input);
43-
expect(input).toEqual(expected);
43+
expect(input).toEqual(copyOfInput);
4444
});
4545

4646
// Given an array of strings or numbers

0 commit comments

Comments
 (0)