Skip to content

Commit

Permalink
Improve test in template/test/index.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
thetarnav committed Sep 25, 2023
1 parent a95ddae commit b480299
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions template/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ import { createRoot } from "solid-js";
import { createPrimitiveTemplate } from "../src/index.js";

describe("createPrimitiveTemplate", () => {
test("createPrimitiveTemplate return values", () =>
createRoot(dispose => {
test("createPrimitiveTemplate return values", () => {
const { value, setValue, dispose } = createRoot(dispose => {
const [value, setValue] = createPrimitiveTemplate(true);
expect(value(), "initial value should be true").toBe(true);
setValue(false);
expect(value(), "value after change should be false").toBe(false);
dispose();
}));

return { value, setValue, dispose };
});

setValue(false);
expect(value(), "value after change should be false").toBe(false);

dispose();
});
});

0 comments on commit b480299

Please sign in to comment.