Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
thetarnav authored and github-actions[bot] committed Sep 13, 2024
1 parent c962df6 commit 6fe0964
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions packages/destructure/test/destructure.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,27 @@ import { destructure } from "../src/index.js";

describe("destructure", () => {
test("props", () => {
const [get_count, set_count] = createSignal(0)
const [get_label, set_label] = createSignal("foo")
const [get_highlight, set_highlight] = createSignal(false)
const [get_count, set_count] = createSignal(0);
const [get_label, set_label] = createSignal("foo");
const [get_highlight, set_highlight] = createSignal(false);

const props: { count: number; label: string; highlight: boolean } = {
get count() {return get_count()},
get label() {return get_label()},
get highlight() {return get_highlight()},
}
get count() {
return get_count();
},
get label() {
return get_label();
},
get highlight() {
return get_highlight();
},
};

const [{ count, label, highlight }, dispose] = createRoot(dispose => [
destructure(props),
dispose,
]);

const [{count, label, highlight}, dispose] = createRoot(dispose => [destructure(props), dispose])

expect(count()).toBe(0);
expect(label()).toBe("foo");
expect(highlight()).toBe(false);
Expand All @@ -29,7 +38,7 @@ describe("destructure", () => {
expect(highlight()).toBe(true);

dispose();
})
});

test("spread array", () =>
createRoot(dispose => {
Expand Down

0 comments on commit 6fe0964

Please sign in to comment.