Skip to content

Commit

Permalink
Merge pull request #259 from digital-value-apps/fix_allow_falsy_args
Browse files Browse the repository at this point in the history
fix(): do not remove falsy values from queue.process args
  • Loading branch information
kamilmysliwiec authored Feb 3, 2020
2 parents bab38bc + 0f891c3 commit fbe373b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/bull.explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class BullExplorer implements OnModuleInit {
options && options.concurrency,
instance[key].bind(instance) as ProcessCallbackFunction<unknown>,
];
args = args.filter(item => item);
args = args.filter(item => item !== undefined);
queue.process.call(queue, ...args);
}

Expand Down
10 changes: 10 additions & 0 deletions lib/test/bull.explorer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ describe('bullExplorer', () => {
expect.any(Function),
);
});
it('should add the given function to the queue handlers with concurrency with a 0 value', () => {
const instance = { handler: jest.fn() };
const queue = { process: jest.fn() } as any;
const opts = { concurrency: 0 };
bullExplorer.handleProcessor(instance, 'handler', queue, opts);
expect(queue.process).toHaveBeenCalledWith(
opts.concurrency,
expect.any(Function),
);
});
it('should add the given function to the queue handlers with name', () => {
const instance = { handler: jest.fn() };
const queue = { process: jest.fn() } as any;
Expand Down

0 comments on commit fbe373b

Please sign in to comment.