2022-09-07 11:58:39 +00:00
|
|
|
const models = require('vn-loopback/server/server').models;
|
2022-09-26 12:49:11 +00:00
|
|
|
const https = require('https');
|
2022-09-07 11:58:39 +00:00
|
|
|
|
2022-09-26 12:49:11 +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};
|
|
|
|
|
2022-09-26 12:49:11 +00:00
|
|
|
const id = 1;
|
|
|
|
const video = 'video.mp4';
|
2022-09-07 11:58:39 +00:00
|
|
|
|
|
|
|
const response = {
|
2022-09-26 12:49:11 +00:00
|
|
|
pipe: () => {},
|
|
|
|
on: () => {},
|
|
|
|
end: () => {},
|
|
|
|
};
|
|
|
|
|
|
|
|
const req = {
|
|
|
|
headers: 'apiHeader',
|
2022-09-07 11:58:39 +00:00
|
|
|
data: {
|
|
|
|
pipe: () => {},
|
|
|
|
on: () => {},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-09-26 12:49:11 +00:00
|
|
|
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
|
|
|
|
2022-09-26 12:49:11 +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;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|