more tests

This commit is contained in:
Schluffe
2026-08-15 22:22:04 +02:00
parent 09b6282a2e
commit e041b5fdfc
3 changed files with 33 additions and 10 deletions
+23
View File
@@ -0,0 +1,23 @@
import { expect, test, vi } from "vitest";
import { createEffect, createSignal } from "./Signal.ts";
test("createSignal", () => {
const [test, setTest] = createSignal("foo");
expect(test()).toEqual("foo");
setTest("bar");
expect(test()).toEqual("bar");
});
test("createEffect", () => {
const [test, setTest] = createSignal("foo");
const callback = vi.fn(test);
createEffect(callback);
expect(callback).toHaveBeenCalledTimes(1);
setTest("bar");
expect(callback).toHaveBeenCalledTimes(2);
});