dotfiles/vscode/.vscode/extensions/randomfractalsinc.vscode-data-preview-2.3.0/node_modules/array-back/test.js
Errol Sancaktar ff17c17e23 vscode
2024-06-14 09:31:58 -06:00

25 lines
616 B
JavaScript

'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)
})