Skip to content

Commit

Permalink
AbstractSocketProviderTest updated
Browse files Browse the repository at this point in the history
  • Loading branch information
nivida committed Aug 5, 2019
1 parent f84adbd commit cca6567
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ describe('AbstractSocketProviderTest', () => {
});

it('calls clearSubscriptions and one unsubscribe call returns false', async () => {
abstractSocketProvider.subscriptions.set('0x0', {id: '0x0'});
abstractSocketProvider.subscriptions.set('0x0', {id: '0x0', subscribeMethod: 'eth_subscribe'});
abstractSocketProvider.removeAllListeners = jest.fn();

abstractSocketProvider.send = jest.fn((subscribeMethod, parameters) => {
Expand All @@ -270,12 +270,10 @@ describe('AbstractSocketProviderTest', () => {
await expect(abstractSocketProvider.clearSubscriptions('eth_unsubscribe')).rejects.toThrow(
`Could not unsubscribe all subscriptions: ${JSON.stringify([false])}`
);

expect(abstractSocketProvider.removeAllListeners).toHaveBeenCalledWith('0x0');
});

it('calls clearSubscriptions and all unsubscribe calls are returning true', async () => {
abstractSocketProvider.subscriptions.set('0x0', {id: '0x0'});
abstractSocketProvider.subscriptions.set('0x0', {id: '0x0', subscribeMethod: 'eth_subscribe'});
abstractSocketProvider.removeAllListeners = jest.fn();

abstractSocketProvider.send = jest.fn((subscribeMethod, parameters) => {
Expand All @@ -290,8 +288,6 @@ describe('AbstractSocketProviderTest', () => {

expect(response).toEqual(true);

expect(abstractSocketProvider.removeAllListeners).toHaveBeenCalledWith('0x0');

expect(abstractSocketProvider.subscriptions).toEqual(new Map());
});

Expand Down

0 comments on commit cca6567

Please sign in to comment.