refs #6184 saveCmr #1788
|
@ -96,6 +96,7 @@ async function test() {
|
|||
|
||||
// runner.loadConfigFile('back/jasmine.json');
|
||||
runner.loadConfig(config);
|
||||
process.env.SPEC_IS_RUNNING = true;
|
||||
await runner.execute();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
guillermo marked this conversation as resolved
|
||||
|
||||
describe('route downloadCmrsZip()', () => {
|
||||
beforeEach(() => {
|
||||
spyOn(models.Route, 'downloadCmrsZip').and.returnValue(true);
|
||||
});
|
||||
|
||||
it('should create a zip file with the given cmr ids', async() => {
|
||||
const tx = await models.Route.beginTransaction({});
|
||||
const ctx = {
|
||||
|
@ -19,7 +15,7 @@ describe('route downloadCmrsZip()', () => {
|
|||
try {
|
||||
const stream = await models.Route.downloadCmrsZip(ctx, cmrs);
|
||||
|
||||
expect(stream).toBeTrue();
|
||||
expect(stream[0]).toBeDefined();
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
|
||||
describe('ticket saveCmr()', () => {
|
||||
beforeEach(() => {
|
||||
spyOn(models.Ticket, 'saveCmr').and.returnValue(true);
|
||||
});
|
||||
|
||||
it(`should throw error if the cmr can't save`, async() => {
|
||||
const tx = await models.Ticket.beginTransaction({});
|
||||
const ctx = {
|
||||
|
@ -18,11 +14,11 @@ describe('ticket saveCmr()', () => {
|
|||
};
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
const ticket = [1];
|
||||
await models.Ticket.saveCmr(ctx, ticket);
|
||||
const ticket = [2];
|
||||
await models.Ticket.saveCmr(ctx, ticket, options);
|
||||
|
||||
const hasDmsCmr = await models.TicketDms.findOne({
|
||||
where: {ticketFk: ticket[1]},
|
||||
where: {ticketFk: ticket[0]},
|
||||
include: [{
|
||||
relation: 'dms',
|
||||
fields: ['id'],
|
||||
|
@ -35,7 +31,7 @@ describe('ticket saveCmr()', () => {
|
|||
}]
|
||||
}, options);
|
||||
|
||||
expect(hasDmsCmr?.dms()?.dmsType()).toEqual(1);
|
||||
expect(hasDmsCmr?.dms()?.id).toBeGreaterThanOrEqual(1);
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
|
|
|
@ -35,7 +35,8 @@ module.exports = {
|
|||
logger.error(`[Print] => ${err.message}`);
|
||||
});
|
||||
|
||||
cluster.on('queue', () => logger.info('Printing task initialized by pool'));
|
||||
cluster.on('queue', () =>
|
||||
process.env.SPEC_IS_RUNNING === 'false' && logger.info('Printing task initialized by pool'));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
No acabo de ver el enfoque de este test. Al final lo que estas haciendo es mockear la funcion para que devuelva lo que quieres. Realmente no esta testeando nada.
Veria mejor enfoque mockear generateNodeStream que es lo que supongo que debes evitar hacer.
Recuerda usar rollback
Falta esta parte