const models = require('vn-loopback/server/server').models; const https = require('https'); xdescribe('boxing getVideo()', () => { it('should return data', async() => { const tx = await models.PackingSiteConfig.beginTransaction({}); try { const options = {transaction: tx}; const id = 1; const video = 'video.mp4'; const response = { pipe: () => {}, on: () => {}, end: () => {}, }; const req = { headers: 'apiHeader', data: { pipe: () => {}, on: () => {}, } }; spyOn(https, 'request').and.returnValue(response); const result = await models.Boxing.getVideo(id, video, req, null, options); expect(result[0]).toEqual(response.data.videos[0].filename); await tx.rollback(); } catch (e) { await tx.rollback(); throw e; } }); });