mirror of
https://github.com/status-im/realm-js.git
synced 2025-02-03 18:24:04 +00:00
Check for some iterator methods before testing them
Some JS engines (like Chrome) are skipping over values() due to a web compatibility reason for right now.
This commit is contained in:
parent
bceef3c340
commit
72bf66e57e
@ -567,9 +567,16 @@ module.exports = BaseTest.extend({
|
|||||||
TestCase.assertEqual(list.reduce(function(n, p) {return n + p.age}, 0), 33);
|
TestCase.assertEqual(list.reduce(function(n, p) {return n + p.age}, 0), 33);
|
||||||
TestCase.assertEqual(list.reduceRight(function(n, p) {return n + p.age}, 0), 33);
|
TestCase.assertEqual(list.reduceRight(function(n, p) {return n + p.age}, 0), 33);
|
||||||
|
|
||||||
TestCase.assertEqual(list.entries().next().value[1].name, 'Ari');
|
// Some of these may not be present in every environment.
|
||||||
TestCase.assertEqual(list.keys().next().value, 0);
|
if (list.entries) {
|
||||||
TestCase.assertEqual(list.values().next().value.name, 'Ari');
|
TestCase.assertEqual(list.entries().next().value[1].name, 'Ari');
|
||||||
|
}
|
||||||
|
if (list.keys) {
|
||||||
|
TestCase.assertEqual(list.keys().next().value, 0);
|
||||||
|
}
|
||||||
|
if (list.values) {
|
||||||
|
TestCase.assertEqual(list.values().next().value.name, 'Ari');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user