Skip to content

Commit

Permalink
test: simplify computed last sub test case
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Sep 22, 2024
1 parent 6fcb801 commit d1764a1
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions packages/reactivity/__tests__/computed.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d1764a1

Please sign in to comment.