salix/modules/invoiceIn/back/methods/invoice-in/specs/getSerial.spec.js

25 lines
843 B
JavaScript
Raw Permalink Normal View History

2023-03-28 09:34:14 +00:00
const models = require('vn-loopback/server/server').models;
describe('invoiceIn getSerial()', () => {
it('should check that returns without serial param', async() => {
2023-03-28 11:45:26 +00:00
const ctx = {args: {daysAgo: 45}};
const result = await models.InvoiceIn.getSerial(ctx);
2023-03-28 09:34:14 +00:00
expect(result.length).toBeGreaterThan(0);
});
it('should check that returns with serial param', async() => {
2023-03-28 11:45:26 +00:00
const ctx = {args: {daysAgo: 45, serial: 'R'}};
const result = await models.InvoiceIn.getSerial(ctx);
2023-03-28 09:34:14 +00:00
expect(result.length).toBeGreaterThan(0);
});
it('should check that returns with non exist serial param', async() => {
2023-03-28 11:45:26 +00:00
const ctx = {args: {daysAgo: 45, serial: 'Mock serial'}};
const result = await models.InvoiceIn.getSerial(ctx);
2023-03-28 09:34:14 +00:00
expect(result.length).toEqual(0);
});
});