refs #6915 test into dev #2093
|
@ -10,12 +10,12 @@ const ticket1 = {
|
|||
'shipped': Date.vnNew(),
|
||||
'nickname': 'MRW',
|
||||
'addressFk': 1,
|
||||
'agencyModeFk': 26
|
||||
'agencyModeFk': 999
|
||||
};
|
||||
|
||||
const expedition1 = {
|
||||
'id': 14,
|
||||
'agencyModeFk': 26,
|
||||
'agencyModeFk': 999,
|
||||
'ticketFk': 44,
|
||||
'freightItemFk': 71,
|
||||
'created': '2001-01-01',
|
||||
|
@ -28,18 +28,52 @@ const expedition1 = {
|
|||
'isBox': 71,
|
||||
'editorFk': 100
|
||||
};
|
||||
const tusabeh = async() => {
|
||||
return {};
|
||||
};
|
||||
|
||||
fdescribe('MRWConfig createShipment()', () => {
|
||||
beforeAll(async() => {
|
||||
|
||||
});
|
||||
|
||||
it('should create a shipment and return a base64Binary label', async() => {
|
||||
const tx = await models.MrwConfig.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
const options = {transaction: await models.MrwConfig.beginTransaction({})};
|
||||
await models.Agency.create(
|
||||
{'id': 999, 'name': 'mrw'},
|
||||
options
|
||||
);
|
||||
|
||||
await models.Ticket.create(ticket1, options);
|
||||
const expedition = await models.Expedition.create(expedition1, options);
|
||||
await models.AgencyMode.create(
|
||||
{'id': 999, 'name': 'mrw', 'agencyFk': 999, 'code': 'mrw'},
|
||||
options
|
||||
);
|
||||
|
||||
await models.MrwConfig.create(
|
||||
{
|
||||
'url': 'https://url.com',
|
||||
'user': 'user',
|
||||
'password': 'password',
|
||||
'franchiseCode': 'franchiseCode',
|
||||
'subscriberCode': 'subscriberCode'
|
||||
}, options
|
||||
);
|
||||
|
||||
await models.Application.rawSql(
|
||||
`INSERT INTO vn.mrwService
|
||||
SET agencyModeCodeFk = 'mrw',
|
||||
clientType = 1,
|
||||
serviceType = 1,
|
||||
kg = 1`, null, options
|
||||
);
|
||||
const ticket = models.Ticket.create(ticket1, options);
|
||||
const expedition = models.Expedition.create(expedition1, options);
|
||||
spyOn(axios, 'post').and.returnValues([{data: mockShipmentId}, {data: mockBase64Binary}]);
|
||||
|
||||
const base64Binary = await models.MrwConfig.createShipment(expedition.id, options);
|
||||
|
||||
expect(base64Binary).toEqual(mockBase64Binary);
|
||||
expect(1).toEqual(1);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue