Skip to content

Commit 1188bb8

Browse files
authored
test: document return value when item was not found (#1779)
1 parent 697e82a commit 1188bb8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/unit/util.spec.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
import { find, deepCopy, forEachValue, isObject, isPromise, assert } from '@/util'
22

33
describe('util', () => {
4-
it('find', () => {
4+
it('find: returns item when it was found', () => {
55
const list = [33, 22, 112, 222, 43]
66
expect(find(list, function (a) { return a % 2 === 0 })).toEqual(22)
77
})
88

9+
it('find: returns undefined when item was not found', () => {
10+
const list = [1, 2, 3]
11+
expect(find(list, function (a) { return a === 9000 })).toEqual(undefined)
12+
})
13+
914
it('deepCopy: normal structure', () => {
1015
const original = {
1116
a: 1,

0 commit comments

Comments
 (0)