Skip to content

Commit 876c2be

Browse files
Remove comment out lines for test cases in dedupe, describeMedian, and sum functions for clarity and consistency
1 parent 14a4cc4 commit 876c2be

3 files changed

Lines changed: 0 additions & 42 deletions

File tree

‎Sprint-1/implement/dedupe.test.js‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,14 @@ E.g. dedupe([1, 2, 1]) returns [1, 2]
1313

1414
// Acceptance Criteria:
1515

16-
// Given an empty array
17-
// When passed to the dedupe function
18-
// Then it should return an empty array
1916
test("given an empty array, it returns an empty array", () => {
2017
expect(dedupe([])).toEqual([]);
2118
});
2219

23-
// Given an array with no duplicates
24-
// When passed to the dedupe function
25-
// Then it should return a copy of the original array
2620
test("given an array with no duplicates, it returns the copy of same array", () => {
2721
expect(dedupe([3, 19, 53, 467])).toEqual([3, 19, 53, 467]);
2822
});
2923

30-
// Given an array of strings or numbers
31-
// When passed to the dedupe function
32-
// Then it should return a new array with duplicates removed while preserving the
33-
// first occurrence of each element from the original array.
3424
test("given an array of strings or numbers, returns the array with duplicates removed and first occurrence preserved", () => {
3525
expect(dedupe([7, "hi", 567, "a", 7, "hi", "b"])).toEqual([
3626
7,

‎Sprint-1/implement/describe-median.test.js‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,15 @@ message, so the caller can see what went wrong.
1515

1616
const describeMedian = require("./describe-median.js");
1717

18-
// Acceptance criteria:
19-
20-
// Given an array of numbers
21-
// When passed to describeMedian
22-
// Then it should return "The median is " followed by the median
23-
// Delete this test.todo and replace it with a test.
2418
test('given [1, 2, 3], returns "The median is 2"', () => {
2519
expect(describeMedian([1, 2, 3])).toEqual("The median is 2");
2620
});
2721

28-
// Given an empty array
29-
// When passed to describeMedian
30-
// Then it should return "Could not calculate a median: calculateMedian requires a non-empty array"
3122
test('given empty array, returns "Could not calculate a median: calculateMedian requires a non-empty array"', () => {
3223
expect(describeMedian([])).toEqual(
3324
"Could not calculate a median: calculateMedian requires a non-empty array"
3425
);
3526
});
36-
// Given something that isn't an array of numbers, e.g. "banana"
37-
// When passed to describeMedian
38-
// Then it should return "Could not calculate a median: calculateMedian requires an array of numbers"
3927
test('given something that isnt an array of numbers, returns "Could not calculate a median: calculateMedian requires an array of numbers"', () => {
4028
expect(describeMedian("Non-array")).toEqual(
4129
"Could not calculate a median: calculateMedian requires an array of numbers"

‎Sprint-1/implement/sum.test.js‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,46 +8,26 @@ E.g. sum(['hey', 10, 'hi', 60, 10]) throws Error("sum requires an array of numbe
88

99
const sum = require("./sum.js");
1010

11-
// Acceptance Criteria:
12-
13-
// Given an empty array
14-
// When passed to the sum function
15-
// Then it should return 0
1611
test("given an empty array, returns 0", () => {
1712
expect(sum([])).toEqual(0);
1813
});
1914

20-
// Given an array with just one number
21-
// When passed to the sum function
22-
// Then it should return that number
2315
test("given an array with one number, returns that number", () => {
2416
expect(sum([100])).toEqual(100);
2517
});
26-
// Given an array containing negative numbers
27-
// When passed to the sum function
28-
// Then it should still return the correct total sum
2918
test("given an array with just negative numbers, returns the correct total sum", () => {
3019
expect(sum([-7, -2, -13, -121, -1345])).toEqual(-1488);
3120
});
3221

33-
// Given an array with decimal/float numbers
34-
// When passed to the sum function
35-
// Then it should return the correct total sum
3622
test("given an array with decimal numbers, returns the correct total sum", () => {
3723
expect(sum([0.1, 1.2, 23.67, 0.0012, 467.89])).toEqual(492.8612);
3824
});
3925

40-
// Given an array containing a value that isn't a number
41-
// When passed to the sum function
42-
// Then it should throw Error("sum requires an array of numbers")
4326
test("given an array containing a value that isn't a number, throw Error", () => {
4427
expect(sum([48, 288, "hi", 576])).toThrow(
4528
new Error("sum requires an array of numbers")
4629
);
4730
});
48-
// Given something that isn't an array at all, such as "hey", 42 or no argument
49-
// When passed to the sum function
50-
// Then it should throw Error("sum requires an array of numbers")
5131
test("given something that isn't an array, throw Error", () => {
5232
expect(sum("This is a string")).toThrow(
5333
new Error("sum requires an array of numbers")

0 commit comments

Comments
 (0)