refs #6915 master into test #2092
|
@ -39,7 +39,7 @@ module.exports = Self => {
|
|||
const xmlString = response.data;
|
||||
const parser = new DOMParser();
|
||||
const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
|
||||
const resultElement = xmlDoc.getElementsByTagName('Mensaje')[0];
|
||||
const [resultElement] = xmlDoc.getElementsByTagName('Mensaje');
|
||||
|
||||
return resultElement.textContent;
|
||||
};
|
||||
|
|
|
@ -87,8 +87,6 @@ module.exports = Self => {
|
|||
const file = getTextByTag(getLabelResponse, 'EtiquetaFile');
|
||||
|
||||
await models.Expedition.updateAll({id: expeditionFk}, {externalId: shipmentId}, myOptions);
|
||||
await myOptions.transaction.commit();
|
||||
|
||||
return file;
|
||||
};
|
||||
|
||||
|
|
|
@ -28,15 +28,15 @@ const expedition1 = {
|
|||
'editorFk': 100
|
||||
};
|
||||
|
||||
const returnsValues = [
|
||||
{data: fs.readFileSync(__dirname + '/mockGetLabel.xml', 'utf-8')},
|
||||
{data: fs.readFileSync(__dirname + '/mockCreateShipment.xml', 'utf-8')}
|
||||
];
|
||||
let tx;
|
||||
let options;
|
||||
|
||||
fdescribe('MRWConfig createShipment()', () => {
|
||||
beforeAll(async() => {
|
||||
options = {transaction: await models.MrwConfig.beginTransaction({})};
|
||||
describe('MRWConfig createShipment()', () => {
|
||||
beforeEach(async() => {
|
||||
options = tx = undefined;
|
||||
tx = await models.MrwConfig.beginTransaction({});
|
||||
options = {transaction: tx};
|
||||
|
||||
await models.Agency.create(
|
||||
{'id': 999, 'name': 'mrw'},
|
||||
options
|
||||
|
@ -68,12 +68,18 @@ fdescribe('MRWConfig createShipment()', () => {
|
|||
await models.Expedition.create(expedition1, options);
|
||||
});
|
||||
|
||||
it('should create a shipment and return a base64Binary label', async() => {
|
||||
spyOn(axios, 'post').and.callFake(() =>
|
||||
Promise.resolve(returnsValues.pop())
|
||||
);
|
||||
afterEach(async() => {
|
||||
await tx.rollback();
|
||||
});
|
||||
|
||||
it('should create a shipment and return a base64Binary label', async() => {
|
||||
const mockPostResponses = [
|
||||
{data: fs.readFileSync(__dirname + '/mockGetLabel.xml', 'utf-8')},
|
||||
{data: fs.readFileSync(__dirname + '/mockCreateShipment.xml', 'utf-8')}
|
||||
];
|
||||
|
||||
spyOn(axios, 'post').and.callFake(() => Promise.resolve(mockPostResponses.pop()));
|
||||
|
||||
await models.Ticket.updateAll({id: ticket1.id}, {shipped: Date.vnNew()}, options);
|
||||
const base64Binary = await models.MrwConfig.createShipment(expedition1.id, options);
|
||||
|
||||
expect(base64Binary).toEqual(mockBase64Binary);
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
"The secret can't be blank": "La contraseña no puede estar en blanco",
|
||||
"We weren't able to send this SMS": "No hemos podido enviar el SMS",
|
||||
"This client can't be invoiced": "Este cliente no puede ser facturado",
|
||||
"You must provide the correction information to generate a corrective invoice": "Debes informar la información de corrección para generar una factura rectificativa",
|
||||
"You must provide the correction information to generate a corrective invoice": "Debes informar la información de corrección para generar una factura rectificativa",
|
||||
"This ticket can't be invoiced": "Este ticket no puede ser facturado",
|
||||
"You cannot add or modify services to an invoiced ticket": "No puedes añadir o modificar servicios a un ticket facturado",
|
||||
"This ticket can not be modified": "Este ticket no puede ser modificado",
|
||||
|
@ -336,5 +336,6 @@
|
|||
"Incorrect pin": "Pin incorrecto",
|
||||
"You already have the mailAlias": "Ya tienes este alias de correo",
|
||||
"You are not allowed to modify the alias": "No estás autorizado a modificar el alias",
|
||||
"No tickets to invoice": "No hay tickets para facturar"
|
||||
}
|
||||
"No tickets to invoice": "No hay tickets para facturar",
|
||||
"1) El servicio solicitado no existe o no es un servicio válido.": "1) El servicio solicitado no existe o no es un servicio válido."
|
||||
}
|
Loading…
Reference in New Issue