test: test immutable + ref

This commit is contained in:
Evan You 2019-08-21 12:03:35 -04:00
parent 0aff144f93
commit 2777cd37b4

View File

@ -8,7 +8,8 @@ import {
markImmutable,
lock,
unlock,
effect
effect,
ref
} from '../src'
describe('reactivity/immutable', () => {
@ -390,4 +391,11 @@ describe('reactivity/immutable', () => {
expect(isImmutable(obj.foo)).toBe(false)
expect(isImmutable(obj.bar)).toBe(true)
})
test('should make ref immutable', () => {
const n: any = immutable(ref(1))
n.value = 2
expect(n.value).toBe(1)
expect(warn).toHaveBeenCalledTimes(1)
})
})