Skip to content

Commit

Permalink
unit test update removeAllListeners
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesaucode committed Jul 6, 2021
1 parent 5d565fb commit ff26889
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,11 @@ describe('StorageProvider test', () => {
return Promise.resolve(credentials);
});
const mockCallback = jest.fn();
const mockRemoveAllListeners = jest.fn();
const mockEventEmitter = {
emit: jest.fn(),
on: jest.fn(),
removeAllListeners: mockRemoveAllListeners,
};
jest
.spyOn(events, 'EventEmitter')
Expand Down Expand Up @@ -265,6 +267,7 @@ describe('StorageProvider test', () => {
// Manully invoke it for testing
emitterOnFn('arg');
expect(mockCallback).toBeCalledWith('arg');
expect(mockRemoveAllListeners).toHaveBeenCalled();
});

test('get object with incorrect progressCallback type', async () => {
Expand All @@ -275,6 +278,7 @@ describe('StorageProvider test', () => {
const mockEventEmitter = {
emit: jest.fn(),
on: jest.fn(),
removeAllListeners: jest.fn(),
};
jest
.spyOn(events, 'EventEmitter')
Expand Down

0 comments on commit ff26889

Please sign in to comment.