salix/modules/route/back/methods/cmr/specs/downloadZip.spec.js

26 lines
711 B
JavaScript
Raw Normal View History

const models = require('vn-loopback/server/server').models;
2024-11-12 07:25:23 +00:00
describe('route downloadZip()', () => {
it('should create a zip file with the given cmr ids', async() => {
2024-01-30 08:50:53 +00:00
const tx = await models.Route.beginTransaction({});
const ctx = {
req: {
getLocale: () => {
return 'en';
},
accessToken: {userId: 9}
}
};
let cmrs = '1,2';
2024-01-30 08:50:53 +00:00
try {
2024-11-12 07:25:23 +00:00
const stream = await models.Cmr.downloadZip(ctx, cmrs);
2024-02-06 07:04:19 +00:00
2024-02-06 11:12:45 +00:00
expect(stream[0]).toBeDefined();
2024-01-30 08:50:53 +00:00
await tx.rollback();
} catch (e) {
await tx.rollback();
2024-02-06 07:04:19 +00:00
throw e;
2024-01-30 08:50:53 +00:00
}
});
});