2024-01-23 10:05:39 +00:00
|
|
|
const models = require('vn-loopback/server/server').models;
|
|
|
|
|
2024-11-12 07:25:23 +00:00
|
|
|
describe('route downloadZip()', () => {
|
2024-01-23 10:05:39 +00:00
|
|
|
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({});
|
2024-01-23 10:05:39 +00:00
|
|
|
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
|
|
|
}
|
2024-01-23 10:05:39 +00:00
|
|
|
});
|
|
|
|
});
|