Skip to content

Commit 90d23b1

Browse files
committed
add tests for utility method
1 parent e7bf0af commit 90d23b1

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*!
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import { partition } from '../../../shared/utilities/tsUtils'
7+
import assert from 'assert'
8+
9+
describe('partition', function () {
10+
it('should split the list according to predicate', function () {
11+
const items = [1, 2, 3, 4, 5, 6, 7, 8]
12+
const [even, odd] = partition(items, (i) => i % 2 === 0)
13+
assert.deepStrictEqual(even, [2, 4, 6, 8])
14+
assert.deepStrictEqual(odd, [1, 3, 5, 7])
15+
})
16+
})

0 commit comments

Comments
 (0)