Skip to content

Commit

Permalink
Add test for .edit() not subscribing the signal
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasklaen committed Apr 22, 2022
1 parent 5277427 commit 4cf4fa6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,16 @@ test(`signal.edit() runs immediately, and passes the current value as 1st argume
});
});

test(`signal.edit() doesn't subscribe the signal`, (t) => {
const s = signal('foo');
t.plan(0);
once(
() => s.edit(() => {}),
() => t.fail()
);
s('bar');
});

test(`signal.edit() sends a changed signal after editor finishes`, (t) => {
const s = signal(['foo', 'bar']);
t.plan(1);
Expand Down

0 comments on commit 4cf4fa6

Please sign in to comment.