refs #6403
This commit is contained in:
parent
d2d28889b6
commit
fe79823ce8
|
@ -10,12 +10,12 @@ const ticket1 = {
|
||||||
'shipped': Date.vnNew(),
|
'shipped': Date.vnNew(),
|
||||||
'nickname': 'MRW',
|
'nickname': 'MRW',
|
||||||
'addressFk': 1,
|
'addressFk': 1,
|
||||||
'agencyModeFk': 26
|
'agencyModeFk': 999
|
||||||
};
|
};
|
||||||
|
|
||||||
const expedition1 = {
|
const expedition1 = {
|
||||||
'id': 14,
|
'id': 14,
|
||||||
'agencyModeFk': 26,
|
'agencyModeFk': 999,
|
||||||
'ticketFk': 44,
|
'ticketFk': 44,
|
||||||
'freightItemFk': 71,
|
'freightItemFk': 71,
|
||||||
'created': '2001-01-01',
|
'created': '2001-01-01',
|
||||||
|
@ -28,18 +28,52 @@ const expedition1 = {
|
||||||
'isBox': 71,
|
'isBox': 71,
|
||||||
'editorFk': 100
|
'editorFk': 100
|
||||||
};
|
};
|
||||||
|
const tusabeh = async() => {
|
||||||
|
return {};
|
||||||
|
};
|
||||||
|
|
||||||
fdescribe('MRWConfig createShipment()', () => {
|
fdescribe('MRWConfig createShipment()', () => {
|
||||||
|
beforeAll(async() => {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
it('should create a shipment and return a base64Binary label', async() => {
|
it('should create a shipment and return a base64Binary label', async() => {
|
||||||
const tx = await models.MrwConfig.beginTransaction({});
|
const options = {transaction: await models.MrwConfig.beginTransaction({})};
|
||||||
const options = {transaction: tx};
|
await models.Agency.create(
|
||||||
|
{'id': 999, 'name': 'mrw'},
|
||||||
|
options
|
||||||
|
);
|
||||||
|
|
||||||
await models.Ticket.create(ticket1, options);
|
await models.AgencyMode.create(
|
||||||
const expedition = await models.Expedition.create(expedition1, options);
|
{'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}]);
|
spyOn(axios, 'post').and.returnValues([{data: mockShipmentId}, {data: mockBase64Binary}]);
|
||||||
|
|
||||||
const base64Binary = await models.MrwConfig.createShipment(expedition.id, options);
|
const base64Binary = await models.MrwConfig.createShipment(expedition.id, options);
|
||||||
|
|
||||||
expect(base64Binary).toEqual(mockBase64Binary);
|
expect(base64Binary).toEqual(mockBase64Binary);
|
||||||
|
expect(1).toEqual(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue