const models = require('vn-loopback/server/server').models; const axios = require('axios'); describe('boxing getVideoList()', () => { it('should return data', async() => { const tx = await models.PackingSiteConfig.beginTransaction({}); try { const options = {transaction: tx}; const params = { id: 1, from: 1, to: 2 }; const response = { data: { pipe: () => {}, on: () => {}, } }; spyOn(axios, 'get').and.returnValue(new Promise(resolve => resolve(response))); const result = await models.Sale.canEdit(params, options); expect(result).toEqual([]); await tx.rollback(); } catch (e) { await tx.rollback(); throw e; } }); });