test repairs plus some traductions

This commit is contained in:
Carlos Jimenez Ruiz 2019-03-29 13:14:48 +01:00
parent d2331ccd68
commit 0fb95bc8d2
5 changed files with 44 additions and 20 deletions

View File

@ -39,5 +39,6 @@
"can't be blank": "can't be blank",
"Street cannot be empty": "Street cannot be empty",
"City cannot be empty": "City cannot be empty",
"EXTENSION_INVALID_FORMAT": "EXTENSION_INVALID_FORMAT"
"EXTENSION_INVALID_FORMAT": "Invalid extension",
"The secret can't be blank": "The secret can't be blank"
}

View File

@ -75,5 +75,6 @@
"Code cannot be blank": "Código no puede estar en blanco",
"You cannot remove this department": "No puedes eliminar este departamento",
"The extension must be unique": "La extensión debe ser unica",
"The secret can't be blank": "La contraseña no puede estar en blanco"
"The secret can't be blank": "La contraseña no puede estar en blanco",
"EXTENSION_INVALID_FORMAT": "La extensión es invalida"
}

View File

@ -2,28 +2,30 @@ const app = require('vn-loopback/server/server');
describe('invoiceOut summary()', () => {
it('should return a summary object containing data from one invoiceOut', async() => {
let result = await app.models.InvoiceOut.summary(1);
const result = await app.models.InvoiceOut.summary(1);
expect(result.invoiceOut.id).toEqual(1);
});
it(`should return a summary object containing data from it's tickets`, async() => {
let result = await app.models.InvoiceOut.summary(1);
const result = await app.models.InvoiceOut.summary(1);
const tickets = result.invoiceOut.tickets();
expect(result.invoiceOut.ref).toEqual('T1111111');
expect(result.invoiceOut.tickets().length).toEqual(1);
expect(tickets.length).toEqual(1);
});
it(`should return a summary object containing it's supplier country`, async() => {
let result = await app.models.InvoiceOut.summary(1);
const result = await app.models.InvoiceOut.summary(1);
const supplier = result.invoiceOut.supplier();
expect(result.invoiceOut.ref).toEqual('T1111111');
expect(result.invoiceOut.supplier().id).toEqual(442);
expect(result.invoiceOut.supplier().countryFk).toEqual(1);
expect(supplier.id).toEqual(442);
expect(supplier.countryFk).toEqual(1);
});
it(`should return a summary object containing idata from it's tax types`, async() => {
let result = await app.models.InvoiceOut.summary(1);
const result = await app.models.InvoiceOut.summary(1);
expect(result.invoiceOut.ref).toEqual('T1111111');
expect(result.invoiceOut.taxesBreakdown.length).toEqual(2);

View File

@ -1,9 +1,9 @@
const app = require('vn-loopback/server/server');
describe('route summary()', () => {
it('should return a summary object containing data from his tickets', async() => {
let result = await app.models.Route.getTickets(1);
describe('route getTickets()', () => {
it('should return the tickets for a given route', async() => {
let result = await app.models.Route.getTickets(2);
expect(result[2].id).toEqual(11);
expect(result.length).toEqual(4);
});
});

View File

@ -1,16 +1,36 @@
const app = require('vn-loopback/server/server');
describe('route summary()', () => {
it('should return a summary object containing data from 1 route', async() => {
let result = await app.models.Route.summary(2);
it('should return a summary object containing data from one route', async() => {
const result = await app.models.Route.summary(1);
expect(result.route.id).toEqual(2);
expect(result.route.workerFk).toEqual(56);
expect(result.route.id).toEqual(1);
});
it('should return a summary object containing data from his tickets', async() => {
let result = await app.models.Route.summary(1);
it(`should return a summary object containing it's agency`, async() => {
const result = await app.models.Route.summary(1);
const agency = result.route.agencyMode();
expect(result.tickets[2].id).toEqual(11);
expect(agency.name).toEqual('inhouse pickup');
});
it(`should return a summary object containing it's vehicle`, async() => {
const result = await app.models.Route.summary(1);
const vehicle = result.route.vehicle();
expect(vehicle.numberPlate).toEqual('3333-BAT');
});
it(`should return a summary object containing it's worker`, async() => {
const result = await app.models.Route.summary(1);
const worker = result.route.worker().user();
expect(worker.nickname).toEqual('deliveryNick');
});
it(`should return a summary object containing data from it's tickets`, async() => {
const result = await app.models.Route.summary(2);
expect(result.tickets.length).toEqual(4);
});
});