salix/modules/ticket/back/methods/boxing/specs/getVideo.spec.js

41 lines
1.0 KiB
JavaScript
Raw Normal View History

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