Skip to content

Commit b4ec63a

Browse files
committed
added tests that check for some negatives and all negatives input
1 parent 2a31489 commit b4ec63a

File tree

1 file changed

+16
-0
lines changed
  • exercises/109-getLargestElementAtProperty

1 file changed

+16
-0
lines changed

exercises/109-getLargestElementAtProperty/test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,22 @@ test('The function must return the largest element of the array located in the k
3535
expect(output).toBe(15);
3636
});
3737

38+
test('The function must return the largest element of the array located in the key. Testing with some negative values.', () => {
39+
let obj = {
40+
key: [5, 4, 15, -3, -20, 80],
41+
};
42+
let output = getLargestElementAtProperty(obj, 'key');
43+
expect(output).toBe(80);
44+
});
45+
46+
test('The function must return the largest element of the array located in the key. Testing with all negative values.', () => {
47+
let obj = {
48+
key: [-5, -4, -15, -3, -20, -80],
49+
};
50+
let output = getLargestElementAtProperty(obj, 'key');
51+
expect(output).toBe(-3);
52+
});
53+
3854
test('If the array is empty, it should return an empty array', () => {
3955
let obj = {
4056
key: [],

0 commit comments

Comments
 (0)