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

30 lines
945 B
JavaScript

const models = require('vn-loopback/server/server').models;
const axios = require('axios');
describe('boxing getVideoList()', () => {
let tx;
let options;
beforeEach(async() => {
tx = await models.PackingSiteConfig.beginTransaction({});
options = {transaction: tx};
});
afterEach(async() => {
await tx.rollback();
});
it('should make the correct API call', async() => {
const expedition = await models.Expedition.findById(15, null, options);
await expedition.updateAttribute('created', '2000-12-01 07:07:00', options);
const axiosSpy = spyOn(axios, 'get').and.callThrough();
await models.Boxing.getVideoList(expedition.id, undefined, undefined, options);
const expectedStartTime = '2000-12-01T07:00:00';
const calledUrl = axiosSpy.calls.mostRecent().args[0];
expect(calledUrl).toContain(`start=${expectedStartTime}`);
});
});