UNPKG

374 BJavaScriptView Raw
1const toArray = require('./toArray')
2
3describe('toArray', () => {
4 it('should convert a array-like object into an array', () => {
5 const obj = {
6 0: 'zero',
7 1: 'one',
8 2: 'two',
9 3: 'three',
10 4: 'four',
11 length: 5
12 }
13
14 expect(toArray(obj)).toEqual([
15 'zero',
16 'one',
17 'two',
18 'three',
19 'four'
20 ])
21 })
22})