Fix freeze test (#364)
This commit is contained in:
committed by
Yoshua Wuyts
parent
05e8472941
commit
7ff9d319c0
+12
-4
@@ -11,10 +11,18 @@ test('freeze (default)', function (t) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
app.router(['/', function (state, prev, send) {
|
app.router(['/', function (state) {
|
||||||
state.foo = ''
|
// Modifying frozen objects can lead to TypeError
|
||||||
|
try {
|
||||||
|
state.foo = ''
|
||||||
|
} catch (e) {
|
||||||
|
}
|
||||||
t.equal(state.foo, 'bar', 'cannot modify property')
|
t.equal(state.foo, 'bar', 'cannot modify property')
|
||||||
state.bar = 'baz'
|
// Modifying frozen objects can lead to TypeError
|
||||||
|
try {
|
||||||
|
state.bar = 'baz'
|
||||||
|
} catch (e) {
|
||||||
|
}
|
||||||
t.equal(state.bar, undefined, 'cannot add property')
|
t.equal(state.bar, undefined, 'cannot add property')
|
||||||
return document.createElement('div')
|
return document.createElement('div')
|
||||||
}])
|
}])
|
||||||
@@ -32,7 +40,7 @@ test('noFreeze', function (t) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
app.router(['/', function (state, prev, send) {
|
app.router(['/', function (state) {
|
||||||
state.foo = ''
|
state.foo = ''
|
||||||
t.equal(state.foo, '', 'can modify property')
|
t.equal(state.foo, '', 'can modify property')
|
||||||
state.bar = 'baz'
|
state.bar = 'baz'
|
||||||
|
|||||||
Reference in New Issue
Block a user