]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
test: test immutable + ref
authorEvan You <yyx990803@gmail.com>
Wed, 21 Aug 2019 16:03:35 +0000 (12:03 -0400)
committerEvan You <yyx990803@gmail.com>
Wed, 21 Aug 2019 16:03:35 +0000 (12:03 -0400)
packages/reactivity/__tests__/immutable.spec.ts

index 49b2fa57f4be9563b2ac48d157b4e0745828cc60..16889ebcc2daa0bee2da837cc6555d6e71e0888e 100644 (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)
+  })
 })