()
| 1392 | |
| 1393 | |
| 1394 | def test_reduce(): |
| 1395 | items = [1, 2, 3, 4, 5] |
| 1396 | result = [None] |
| 1397 | pm.eval(""" |
| 1398 | (result, arr) => { |
| 1399 | result[0] = arr.reduce((accumulator, currentValue) => accumulator + currentValue, 0); |
| 1400 | } |
| 1401 | """)(result, items) |
| 1402 | assert items == [1, 2, 3, 4, 5] |
| 1403 | assert result[0] == 15 |
| 1404 | |
| 1405 | |
| 1406 | def test_reduce_empty_array_no_accumulator(): |
nothing calls this directly
no outgoing calls
no test coverage detected