Archived
2

material numbers defined as string, colors without numbers and numbers with leading zeros can be added

This commit is contained in:
VLE2FE 2020-05-15 14:56:42 +02:00
parent d2c7ec2368
commit 4100fb428e

View File

@ -3,7 +3,6 @@ import _ from 'lodash';
import MaterialModel from '../models/material'; import MaterialModel from '../models/material';
import TestHelper from "../test/helper"; import TestHelper from "../test/helper";
// TODO: deal with numbers with leading zeros
describe('/material', () => { describe('/material', () => {
let server; let server;
@ -378,7 +377,7 @@ describe('/material', () => {
url: '/material/new', url: '/material/new',
auth: {basic: 'janedoe'}, auth: {basic: 'janedoe'},
httpStatus: 200, httpStatus: 200,
req: {name: 'Crastin CE 2510', supplier: 'Du Pont', group: 'PBT', mineral: 0, glass_fiber: 30, carbon_fiber: 0, numbers: [{color: 'black', number: '5515798402'}]} req: {name: 'Crastin CE 2510', supplier: 'Du Pont', group: 'PBT', mineral: 0, glass_fiber: 30, carbon_fiber: 0, numbers: [{color: 'black', number: '05515798402'}]}
}).end((err, res) => { }).end((err, res) => {
if (err) return done (err); if (err) return done (err);
should(res.body).have.only.keys('_id', 'name', 'supplier', 'group', 'mineral', 'glass_fiber', 'carbon_fiber', 'numbers'); should(res.body).have.only.keys('_id', 'name', 'supplier', 'group', 'mineral', 'glass_fiber', 'carbon_fiber', 'numbers');
@ -392,7 +391,7 @@ describe('/material', () => {
should(res.body.numbers).matchEach(number => { should(res.body.numbers).matchEach(number => {
should(number).have.only.keys('color', 'number'); should(number).have.only.keys('color', 'number');
should(number).have.property('color', 'black'); should(number).have.property('color', 'black');
should(number).have.property('number', '5515798402'); should(number).have.property('number', '05515798402');
}); });
done(); done();
}); });