Sfoglia il codice sorgente

test: simplify computed last sub test case

Evan You 1 anno fa
parent
commit
d1764a142a
1 ha cambiato i file con 2 aggiunte e 9 eliminazioni
  1. 2 9
      packages/reactivity/__tests__/computed.spec.ts

+ 2 - 9
packages/reactivity/__tests__/computed.spec.ts

@@ -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)