Skip to content

Commit

Permalink
test(reactivity): add test
Browse files Browse the repository at this point in the history
  • Loading branch information
OnlyWick committed Mar 13, 2024
1 parent caa2b46 commit eae332f
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion packages/reactivity/__tests__/reactive.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import { isRef, ref } from '../src/ref'
import { isReactive, markRaw, reactive, toRaw } from '../src/reactive'
import {
isProxy,
isReactive,
markRaw,
reactive,
readonly,
shallowReactive,
shallowReadonly,
toRaw,
} from '../src/reactive'
import { computed } from '../src/computed'
import { effect } from '../src/effect'

Expand Down Expand Up @@ -302,4 +311,24 @@ describe('reactivity/reactive', () => {
const observed = reactive(original)
expect(isReactive(observed)).toBe(false)
})

test('isProxy', () => {
const foo = {}
expect(isProxy(foo)).toBe(false)

const fooRe = reactive(foo)
expect(isProxy(fooRe)).toBe(true)

const fooSRe = shallowReactive(foo)
expect(isProxy(fooSRe)).toBe(true)

const barRl = readonly(foo)
expect(isProxy(barRl)).toBe(true)

const barSRl = shallowReadonly(foo)
expect(isProxy(barSRl)).toBe(true)

const c = computed(() => {})
expect(isProxy(c)).toBe(false)
})
})

0 comments on commit eae332f

Please sign in to comment.