Skip to content

Commit

Permalink
test: document return value when item was not found (vuejs#1779)
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz authored Jun 23, 2020
1 parent 697e82a commit 1188bb8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/unit/util.spec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import { find, deepCopy, forEachValue, isObject, isPromise, assert } from '@/util'

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

it('find: returns undefined when item was not found', () => {
const list = [1, 2, 3]
expect(find(list, function (a) { return a === 9000 })).toEqual(undefined)
})

it('deepCopy: normal structure', () => {
const original = {
a: 1,
Expand Down

0 comments on commit 1188bb8

Please sign in to comment.