updated sample restore and validate
This commit is contained in:
@ -271,7 +271,7 @@ describe('/sample', () => {
|
||||
it('adds the specified measurements', done => {
|
||||
TestHelper.request(server, done, {
|
||||
method: 'get',
|
||||
url: '/samples?status[]=new&status[]=validated&fields[]=number&fields[]=measurements.kf',
|
||||
url: '/samples?status[]=new&status[]=validated&fields[]=number&fields[]=measurements.kf.weight%20%25&fields[]=measurements.kf.standard%20deviation',
|
||||
auth: {basic: 'janedoe'},
|
||||
httpStatus: 200
|
||||
}).end((err, res) => {
|
||||
@ -1525,22 +1525,23 @@ describe('/sample', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
it('creates a changelog', done => {
|
||||
it('restores associated measurements', done => {
|
||||
TestHelper.request(server, done, {
|
||||
method: 'put',
|
||||
url: '/sample/restore/400000000000000000000005',
|
||||
auth: {basic: 'admin'},
|
||||
httpStatus: 200,
|
||||
req: {},
|
||||
log: {
|
||||
collection: 'samples',
|
||||
dataAdd: {
|
||||
group_id: '900000000000000000000002',
|
||||
supplier_id: '110000000000000000000002',
|
||||
status: 'new'
|
||||
},
|
||||
dataIgn: ['group_id', 'supplier_id']
|
||||
}
|
||||
req: {}
|
||||
}).end((err, res) => {
|
||||
if (err) return done (err);
|
||||
should(res.body).be.eql({status: 'OK'});
|
||||
MeasurementModel.find({sample_id: mongoose.Types.ObjectId('400000000000000000000005')}).lean().exec((err, data: any) => {
|
||||
if (err) return done(err);
|
||||
should(data).matchEach(measurement => {
|
||||
should(measurement).have.property('status', 'new')
|
||||
});
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
it('rejects an API key', done => {
|
||||
@ -1598,22 +1599,23 @@ describe('/sample', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
it('creates a changelog', done => {
|
||||
it('validates associated measurements', done => {
|
||||
TestHelper.request(server, done, {
|
||||
method: 'put',
|
||||
url: '/sample/validate/400000000000000000000003',
|
||||
auth: {basic: 'admin'},
|
||||
httpStatus: 200,
|
||||
req: {},
|
||||
log: {
|
||||
collection: 'samples',
|
||||
dataAdd: {
|
||||
group_id: '900000000000000000000002',
|
||||
supplier_id: '110000000000000000000002',
|
||||
status: 'validated'
|
||||
},
|
||||
dataIgn: ['group_id', 'supplier_id']
|
||||
}
|
||||
req: {}
|
||||
}).end((err, res) => {
|
||||
if (err) return done (err);
|
||||
should(res.body).be.eql({status: 'OK'});
|
||||
MeasurementModel.find({sample_id: mongoose.Types.ObjectId('400000000000000000000003')}).lean().exec((err, data: any) => {
|
||||
if (err) return done(err);
|
||||
should(data).matchEach(measurement => {
|
||||
should(measurement).have.property('status', 'validated')
|
||||
});
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
it('allows validating a sample without condition', done => {
|
||||
|
Reference in New Issue
Block a user