Skip to content

Commit

Permalink
test: add test case for watchEffect
Browse files Browse the repository at this point in the history
  • Loading branch information
cuixiaorui committed Jul 26, 2022
1 parent 09eadc3 commit bc4f11c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/runtime-core/__tests__/apiWatch.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
describe("api: watch", () => {
it.todo("effect", async () => {
// 先实现个 watchEffect 玩一玩
const state = reactive({ count: 0 });
let dummy;
watchEffect(() => {
dummy = state.count;
});
expect(dummy).toBe(0);

state.count++;
await nextTick();
expect(dummy).toBe(1);
});
});

0 comments on commit bc4f11c

Please sign in to comment.