salix/modules/travel/back/methods/travel/specs/getEntries.spec.js

36 lines
1.1 KiB
JavaScript

const models = require('vn-loopback/server/server').models;
describe('travel getEntries()', () => {
const travelId = 1;
it('should check the response contains the id', async() => {
const entries = await models.Travel.getEntries(travelId);
expect(entries.length).toEqual(1);
expect(entries[0].id).toEqual(1);
});
it('should check the response contains the travelFk', async() => {
const entries = await models.Travel.getEntries(travelId);
expect(entries[0].travelFk).toEqual(1);
});
it('should check the response contains the reference', async() => {
const entries = await models.Travel.getEntries(travelId);
expect(entries[0].reference).toEqual('Movement 1');
});
it('should check the response contains the invoiceNumber', async() => {
const entries = await models.Travel.getEntries(travelId);
expect(entries[0].invoiceNumber).toEqual('IN2001');
});
it('should check the response contains the m3', async() => {
const entries = await models.Travel.getEntries(travelId);
expect(entries[0].m3).toEqual(0.22);
});
});