Commit 910deeb0 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(Utils): add tests for `ensureArray`

parent 64e5a70b
......@@ -129,6 +129,24 @@ TestCase {
// GENERIC.
// =================================================================
function test_ensureArray_data () {
return [
{ input: [ 1, 2, 3 ], output: [ 1, 2, 3 ] },
{ input: { toto: 4, ro: 5 }, output: [ 4, 5 ] },
{ input: new Object(), output: [] },
{ input: new Array(), output: [] },
{ input: { a: 0, b: 1, c: 0 }, output: [ 0, 1, 0 ] }
]
}
function test_ensureArray (data) {
// Use `sort` because transform a object in array hasn't a
// guarantee order.
compare(Utils.ensureArray(data.input).sort(), data.output.sort())
}
// -----------------------------------------------------------------
function test_genRandomNumber_data () {
return [
{ min: 42, max: 3600 },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment