Code coverage report for array-back/test.js

# all files / array-back/ test.js

100% Statements 16/16
100% Branches 0/0
100% Functions 3/3
100% Lines 16/16

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    1×
    1×
    1×

    1×

    1×
    1×
    1×
    1×

    1×
    1×
    1×
    1×
    1×

    1×
    1×

    1×

     'use strict'
    const TestRunner = require('test-runner')
    const arrayify = require('./')
    const a = require('assert')

    const runner = new TestRunner()

    runner.test('if already array, do nothing', function () {
      const arr = [ 1,2,3 ]
      const result = arrayify(arr)
      a.strictEqual(arr, result)
    })

    runner.test('arrayify()', function () {
      a.deepStrictEqual(arrayify(undefined), [])
      a.deepStrictEqual(arrayify(null), [ null ])
      a.deepStrictEqual(arrayify(0), [ 0 ])
      a.deepStrictEqual(arrayify([ 1, 2 ]), [ 1, 2 ])

      function func () {
        a.deepStrictEqual(arrayify(arguments), [ 1, 2, 3 ])
      }
      func(1, 2, 3)
    })