mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-24 07:08:07 +00:00
feat(Utils): add tests for ensureArray
This commit is contained in:
parent
64e5a70b36
commit
910deeb04d
1 changed files with 18 additions and 0 deletions
|
|
@ -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 },
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue