Skip to content

Commit 604d087

Browse files
authored
test(reactivity): add tests for reactive and non-reactive objects (#12576)
1 parent 5e776ae commit 604d087

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

packages/reactivity/__tests__/reactive.spec.ts

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isRef, ref } from '../src/ref'
1+
import { isRef, ref, shallowRef } from '../src/ref'
22
import {
33
isProxy,
44
isReactive,
@@ -426,4 +426,17 @@ describe('reactivity/reactive', () => {
426426
map.set(void 0, 1)
427427
expect(c.value).toBe(1)
428428
})
429+
430+
test('should return true for reactive objects', () => {
431+
expect(isReactive(reactive({}))).toBe(true)
432+
expect(isReactive(readonly(reactive({})))).toBe(true)
433+
expect(isReactive(ref({}).value)).toBe(true)
434+
expect(isReactive(readonly(ref({})).value)).toBe(true)
435+
expect(isReactive(shallowReactive({}))).toBe(true)
436+
})
437+
438+
test('should return false for non-reactive objects', () => {
439+
expect(isReactive(ref(true))).toBe(false)
440+
expect(isReactive(shallowRef({}).value)).toBe(false)
441+
})
429442
})

0 commit comments

Comments
 (0)