Archived
2

PUT finished

This commit is contained in:
VLE2FE
2020-05-14 15:36:47 +02:00
parent 81a7663f6c
commit 8315fc0d3b
11 changed files with 162 additions and 109 deletions

View File

@ -124,6 +124,32 @@ describe('/sample', () => {
});
});
});
it('keeps unchanged notes', done => {
TestHelper.request(server, done, {
method: 'put',
url: '/sample/400000000000000000000002',
auth: {basic: 'janedoe'},
httpStatus: 200,
req: {notes: {comment: 'Stoff gesperrt', sample_references: []}}
}).end((err, res) => {
if (err) return done(err);
should(res.body).be.eql({_id: '400000000000000000000002', number: '21', type: 'granulate', color: 'natural', batch: '1560237365', material_id: '100000000000000000000001', note_id: '500000000000000000000001', user_id: '000000000000000000000002'});
SampleModel.findById('400000000000000000000002').lean().exec((err, data: any) => {
if (err) return done (err);
should(data).have.only.keys('_id', 'number', 'color', 'type', 'batch', 'material_id', 'note_id', 'user_id', 'status', '__v');
should(data).have.property('_id');
should(data).have.property('number', '21');
should(data).have.property('color', 'natural');
should(data).have.property('type', 'granulate');
should(data).have.property('batch', '1560237365');
should(data.material_id.toString()).be.eql('100000000000000000000001');
should(data.user_id.toString()).be.eql('000000000000000000000002');
should(data).have.property('status', 10);
should(data.note_id.toString()).be.eql('500000000000000000000001');
done();
});
});
});
it('changes the given properties', done => {
TestHelper.request(server, done, {
method: 'put',