Skip to content
This repository has been archived by the owner on Feb 7, 2022. It is now read-only.

Commit

Permalink
add a test for keepAliveAfterFinishCallback
Browse files Browse the repository at this point in the history
  • Loading branch information
Behrang Yarahmadi committed Dec 18, 2018
1 parent f6103d7 commit 2a8b6b2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions __tests__/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,19 @@ describe('index.js', () => {
// called with workers
expect(workerFarm.end.mock.calls[0][0]).toBe(workerFarm.end);
});
it('should call keepAliveAfterFinishCallback if flag is set', () => {
const options = {};
Object.defineProperty(options, 'keepAliveAfterFinish', {
value: 500
});
const keepAliveAfterFinishCallback = jest.fn(() => {
setTimeout(expect.any(Function), options.keepAliveAfterFinish);
});
keepAliveAfterFinishCallback();
debugger;
expect(setTimeout).toHaveBeenCalledTimes(1);
expect(setTimeout).toHaveBeenLastCalledWith(expect.any(Function), 500);
});
});

describe('shutdownCallback', () => {
Expand Down

0 comments on commit 2a8b6b2

Please sign in to comment.