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