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
|
// job execution was successful
|
||||||
this.debug(`Completed job ${job._id}`);
|
this.debug(`Completed job ${job._id}`);
|
||||||
|
|
||||||
const emitJob = formatJobObject(job);
|
|
||||||
const completedTime = moment().toISOString();
|
const completedTime = moment().toISOString();
|
||||||
const docOutput = this._formatOutput(output);
|
const docOutput = this._formatOutput(output);
|
||||||
|
|
||||||
|
const emitJob = { job: formatJobObject(job) };
|
||||||
const doc = {
|
const doc = {
|
||||||
status: constants.JOB_STATUS_COMPLETED,
|
status: constants.JOB_STATUS_COMPLETED,
|
||||||
completed_at: completedTime,
|
completed_at: completedTime,
|
||||||
|
|||||||
@@ -601,13 +601,17 @@ describe('Worker class', function () {
|
|||||||
|
|
||||||
worker.once(constants.EVENT_WORKER_COMPLETE, (workerJob) => {
|
worker.once(constants.EVENT_WORKER_COMPLETE, (workerJob) => {
|
||||||
try {
|
try {
|
||||||
expect(workerJob).to.have.property('id');
|
expect(workerJob).to.not.have.property('_source');
|
||||||
expect(workerJob).to.have.property('index');
|
|
||||||
expect(workerJob).to.have.property('type');
|
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).to.have.property('output');
|
||||||
expect(workerJob.output).to.have.property('content');
|
expect(workerJob.output).to.have.property('content');
|
||||||
expect(workerJob.output).to.have.property('content_type');
|
expect(workerJob.output).to.have.property('content_type');
|
||||||
expect(workerJob).to.not.have.property('_source');
|
|
||||||
done();
|
done();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
done(e);
|
done(e);
|
||||||
|
|||||||
Reference in New Issue
Block a user