test: simplify computed last sub test case

This commit is contained in:
Evan You 2024-09-22 11:24:10 +08:00
parent 6fcb80172f
commit d1764a142a
No known key found for this signature in database
GPG Key ID: 00E9AB7A6704CE0A

View File

@ -1013,16 +1013,9 @@ describe('reactivity/computed', () => {
})
test('computed should remain live after losing all subscribers', () => {
const toggle = ref(true)
const state = reactive({
a: 1,
})
const state = reactive({ a: 1 })
const p = computed(() => state.a + 1)
const pp = computed(() => {
return toggle.value ? p.value : 111
})
const { effect: e } = effect(() => pp.value)
const { effect: e } = effect(() => p.value)
e.stop()
expect(p.value).toBe(2)