Skip to content

Commit cc033e1

Browse files
authored
Merge branch 'main' into coursework/sprint-1
2 parents c96038b + 10b3ac9 commit cc033e1

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

Sprint-1/implement/dedupe.test.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ Dedupe Array
66
77
In this kata, you will need to deduplicate the elements of an array
88
9-
E.g. dedupe(['a','a','a','b','b','c']) target output: ['a','b','c']
10-
E.g. dedupe([5, 1, 1, 2, 3, 2, 5, 8]) target output: [5, 1, 2, 3, 8]
11-
E.g. dedupe([1, 2, 1]) target output: [1, 2]
9+
E.g. dedupe(['a','a','a','b','b','c']) returns ['a','b','c']
10+
E.g. dedupe([5, 1, 1, 2, 3, 2, 5, 8]) returns [5, 1, 2, 3, 8]
11+
E.g. dedupe([1, 2, 1]) returns [1, 2]
1212
*/
1313

1414
// Acceptance Criteria:
@@ -34,11 +34,13 @@ test("given an array with no duplicates, it returns a copy of the original array
3434
expect(result).not.toBe(input);
3535
});
3636

37-
// Given an array with strings or numbers
37+
// Given an array of strings or numbers
3838
// When passed to the dedupe function
3939
// Then it should remove the duplicate values, preserving the first occurence of each element
4040
test("given an array with strings or numbers, it removes the duplicate values, preserving the first occurence of each element", () => {
4141
const input = [5, 1, 1, 2, 3, 2, 5, 8, "egg", "egg", "bacon"];
4242
const expectedOutput = [5, 1, 2, 3, 8, "egg", "bacon"];
4343
expect(dedupe(input)).toEqual(expectedOutput);
4444
});
45+
// Then it should return a new array with duplicates removed while preserving the
46+
// first occurrence of each element from the original array.

0 commit comments

Comments
 (0)