]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
test: simplify computed last sub test case
authorEvan You <evan@vuejs.org>
Sun, 22 Sep 2024 03:24:10 +0000 (11:24 +0800)
committerEvan You <evan@vuejs.org>
Sun, 22 Sep 2024 03:24:10 +0000 (11:24 +0800)
packages/reactivity/__tests__/computed.spec.ts

index 90987e867205352bd5b6aa316c5ea5aa98e88f01..873fd11619c922c99788376f2b205ada648a2b9a 100644 (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)