diff --git a/src/routes/measurement.spec.ts b/src/routes/measurement.spec.ts index c1ed0fa..79d0606 100644 --- a/src/routes/measurement.spec.ts +++ b/src/routes/measurement.spec.ts @@ -82,9 +82,10 @@ describe('/measurement', () => { }).end((err, res) => { if (err) return done(err); MeasurementModel.findById(res.body._id).lean().exec((err, data: any) => { - should(data).have.only.keys('_id', 'condition_id', 'values', 'measurement_template', '__v'); + should(data).have.only.keys('_id', 'condition_id', 'values', 'measurement_template', 'status', '__v'); should(data.condition_id.toString()).be.eql('700000000000000000000001'); should(data.measurement_template.toString()).be.eql('300000000000000000000002'); + should(data).have.property('status', 0); should(data).have.property('values'); should(data.values).have.property('weight %', 0.8); should(data.values).have.property('standard deviation', 0.1); diff --git a/src/routes/measurement.ts b/src/routes/measurement.ts index 8dda6cd..9f7bf41 100644 --- a/src/routes/measurement.ts +++ b/src/routes/measurement.ts @@ -33,6 +33,7 @@ router.post('/measurement/new', async (req, res, next) => { if (!await conditionIdCheck(measurement, req, res, next)) return; if (!await templateCheck(measurement, 'new', res, next)) return; + measurement.status = await new MeasurementModel(measurement).save((err, data) => { if (err) return next(err); res.json(MeasurementValidate.output(data.toObject()));