siesta-lite
Version:
Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers
30 lines (21 loc) • 1.07 kB
JavaScript
StartTest(function(t) {
t.ok(Siesta.Util.Serializer, 'Siesta.Util.Serializer is here')
t.it("Serializing various host objects (sometimes accesing their properties throws exceptions)", function (t) {
t.ok(Siesta.Util.Serializer.stringify(window), 'Serialized the `window` object')
var div = document.createElement('div')
t.ok(Siesta.Util.Serializer.stringify(div), 'Serialized the div object')
t.ok(Siesta.Util.Serializer.stringify(window.location), 'Serialized the `window.location` object')
if (typeof Symbol !== 'undefined') {
t.ok(Siesta.Util.Serializer.stringify(Symbol()), 'Serialized the Symbol')
}
})
if (window.Map && !bowser.msie) t.it("Serializing Maps", function (t) {
t.is(
Siesta.Util.Serializer.stringify(
new Map([ [ 'key1', { name1 : 'value1' } ], [ 1, [ 'v1', 'v2' ] ] ])
),
'Map(2){"key1"=>{"name1": "value1"}, 1=>["v1", "v2"]}',
'Correctly serialized the Map instance'
)
})
})