Skip to content

Commit eae332f

Browse files
committed
test(reactivity): add test
1 parent caa2b46 commit eae332f

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

packages/reactivity/__tests__/reactive.spec.ts

+30-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
import { isRef, ref } from '../src/ref'
2-
import { isReactive, markRaw, reactive, toRaw } from '../src/reactive'
2+
import {
3+
isProxy,
4+
isReactive,
5+
markRaw,
6+
reactive,
7+
readonly,
8+
shallowReactive,
9+
shallowReadonly,
10+
toRaw,
11+
} from '../src/reactive'
312
import { computed } from '../src/computed'
413
import { effect } from '../src/effect'
514

@@ -302,4 +311,24 @@ describe('reactivity/reactive', () => {
302311
const observed = reactive(original)
303312
expect(isReactive(observed)).toBe(false)
304313
})
314+
315+
test('isProxy', () => {
316+
const foo = {}
317+
expect(isProxy(foo)).toBe(false)
318+
319+
const fooRe = reactive(foo)
320+
expect(isProxy(fooRe)).toBe(true)
321+
322+
const fooSRe = shallowReactive(foo)
323+
expect(isProxy(fooSRe)).toBe(true)
324+
325+
const barRl = readonly(foo)
326+
expect(isProxy(barRl)).toBe(true)
327+
328+
const barSRl = shallowReadonly(foo)
329+
expect(isProxy(barSRl)).toBe(true)
330+
331+
const c = computed(() => {})
332+
expect(isProxy(c)).toBe(false)
333+
})
305334
})

0 commit comments

Comments
 (0)