this.q.create(name, data) .priority(options.priority || 'normal') .removeOnComplete(options.removeOnComplete || false) .attempts(options.attempts) .ttl((options.ttl ? options.ttl + this.ttl_buffer : 10000 + this.ttl_buffer )) // 10s .backoff(options.backoff) .delay(options.delay) .save(function(err){ debug('Add job ' + job.type + '(' + job.id + ') ' + JSON.stringify(data)) fn && fn(err) })
it('Call job().save() should create a correct job data', function(done){ spinal.start(function(){ spinal.job('test', {data: 1}).save(function(err, job_id){ kue.Job.get(job_id, function(err, job){ expect(job.type).to.be.equal('q-test-client.test') delete job.data._caller_id expect(job.data).to.be.deep.equal({data: 1}) done() }) }) }) })