Skip to content

Commit

Permalink
fix(move-to-waiting-children): make opts optional
Browse files Browse the repository at this point in the history
  • Loading branch information
roggervalf committed Jun 2, 2021
1 parent bf17c7b commit 33bd76a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/classes/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ export class Job<T = any, R = any, N extends string = string> {
*/
moveToWaitingChildren(
token: string,
opts: MoveToChildrenOpts,
opts: MoveToChildrenOpts = {},
): Promise<boolean | Error> {
return Scripts.moveToWaitingChildren(this.queue, this.id, token, opts);
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/test_bulk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('bulk jobs', () => {

it('should allow to pass parent option', async () => {
const name = 'test';
const parentQueueName = 'parent-queue';
const parentQueueName = `parent-queue-${v4()}`;
const parentQueue = new Queue(parentQueueName);

const parentWorker = new Worker(parentQueueName);
Expand Down
4 changes: 2 additions & 2 deletions src/test/test_job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ describe('Job', function() {
const values = [{ idx: 0, bar: 'something' }];
const token = 'my-token';
const token2 = 'my-token2';
const parentQueueName = 'parent-queue-' + v4();
const parentQueueName = `parent-queue-${v4()}`;

const parentQueue = new Queue(parentQueueName);
const parentWorker = new Worker(parentQueueName);
Expand Down Expand Up @@ -323,7 +323,7 @@ describe('Job', function() {
];
const token = 'my-token';

const parentQueueName = 'parent-queue';
const parentQueueName = `parent-queue-${v4()}`;

const parentQueue = new Queue(parentQueueName);

Expand Down
6 changes: 5 additions & 1 deletion src/test/test_worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1775,7 +1775,7 @@ describe('workers', function() {
const parentToken = 'parent-token';
const childToken = 'child-token';

const parentQueueName = 'parent-queue';
const parentQueueName = `parent-queue-${v4()}`;

const parentQueue = new Queue(parentQueueName);
const parentWorker = new Worker(parentQueueName);
Expand Down Expand Up @@ -1866,6 +1866,9 @@ describe('workers', function() {
unprocessed: unprocessed4,
} = await parent.getDependencies();
const isWaitingChildren2 = await parent.isWaitingChildren();
const movedToWaitingChildren2 = await parent.moveToWaitingChildren(
parentToken,
);

expect(processed4).to.deep.equal({
[`bull:${queueName}:${child1.id}`]: `"return value1"`,
Expand All @@ -1874,6 +1877,7 @@ describe('workers', function() {
});
expect(unprocessed4).to.have.length(0);
expect(isWaitingChildren2).to.be.false;
expect(movedToWaitingChildren2).to.be.false;

await childrenWorker.close();
await parentWorker.close();
Expand Down

0 comments on commit 33bd76a

Please sign in to comment.