put job info under job property on success emitter
This commit is contained in:
@@ -183,10 +183,10 @@ export default class Job extends events.EventEmitter {
|
||||
// job execution was successful
|
||||
this.debug(`Completed job ${job._id}`);
|
||||
|
||||
const emitJob = formatJobObject(job);
|
||||
const completedTime = moment().toISOString();
|
||||
const docOutput = this._formatOutput(output);
|
||||
|
||||
const emitJob = { job: formatJobObject(job) };
|
||||
const doc = {
|
||||
status: constants.JOB_STATUS_COMPLETED,
|
||||
completed_at: completedTime,
|
||||
|
||||
@@ -601,13 +601,17 @@ describe('Worker class', function () {
|
||||
|
||||
worker.once(constants.EVENT_WORKER_COMPLETE, (workerJob) => {
|
||||
try {
|
||||
expect(workerJob).to.have.property('id');
|
||||
expect(workerJob).to.have.property('index');
|
||||
expect(workerJob).to.have.property('type');
|
||||
expect(workerJob).to.not.have.property('_source');
|
||||
|
||||
expect(workerJob).to.have.property('job');
|
||||
expect(workerJob.job).to.have.property('id');
|
||||
expect(workerJob.job).to.have.property('index');
|
||||
expect(workerJob.job).to.have.property('type');
|
||||
|
||||
expect(workerJob).to.have.property('output');
|
||||
expect(workerJob.output).to.have.property('content');
|
||||
expect(workerJob.output).to.have.property('content_type');
|
||||
expect(workerJob).to.not.have.property('_source');
|
||||
|
||||
done();
|
||||
} catch (e) {
|
||||
done(e);
|
||||
|
||||
Reference in New Issue
Block a user