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;
        }
    });
});