Skip to content

Commit

Permalink
Creating spec reproducing situation where 'idle' is called but 'willI…
Browse files Browse the repository at this point in the history
…dle' is not
  • Loading branch information
Kurt Preston committed Jun 23, 2021
1 parent f6a4ffe commit 584d4a6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/strongbus_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,16 @@ describe('Strongbus.Bus', () => {
expect(onActive).toHaveBeenCalledTimes(1);
});

fit('handles unsubscribes fired from hooks', async () => {
const sub1 = bus.on('foo', () => {});
const sub2 = bus.on('foo', () => {});
bus.hook('willRemoveListener', () => sub2());

sub1();
expect(onWillIdle).toHaveBeenCalledTimes(1);
expect(onIdle).toHaveBeenCalledTimes(1);
});

it('raises "idle" events independently of delegates', () => {
const foosub = bus.on('foo', onTestEvent);
const fooSub2 = delegate.on('foo', onTestEvent);
Expand Down

0 comments on commit 584d4a6

Please sign in to comment.