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

26 lines
711 B
JavaScript

const models = require('vn-loopback/server/server').models;
describe('route downloadZip()', () => {
it('should create a zip file with the given cmr ids', async() => {
const tx = await models.Route.beginTransaction({});
const ctx = {
req: {
getLocale: () => {
return 'en';
},
accessToken: {userId: 9}
}
};
let cmrs = '1,2';
try {
const stream = await models.Cmr.downloadZip(ctx, cmrs);
expect(stream[0]).toBeDefined();
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});