-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.test.js
More file actions
18 lines (14 loc) · 786 Bytes
/
index.test.js
File metadata and controls
18 lines (14 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import test from 'ava'
import partial from '.'
test('returns true when some elements match the filter', t => {
const sample = [{ id: 'a1', checked: true }, { id: 'a2', checked: false }, { id: 'a3', checked: true }, { id: 'a4', checked: true }]
t.true(partial(sample, x => x.checked))
})
test('returns false when all elements match the filter', t => {
const sample = [{ id: 'a1', checked: true }, { id: 'a2', checked: true }, { id: 'a3', checked: true }, { id: 'a4', checked: true }]
t.false(partial(sample, x => x.checked))
})
test('returns false when no elements match the filter', t => {
const sample = [{ id: 'a1', checked: false }, { id: 'a2', checked: false }, { id: 'a3', checked: false }, { id: 'a4', checked: false }]
t.false(partial(sample, x => x.checked))
})