added backend summary test #520
This commit is contained in:
parent
e391b22eaf
commit
997c4c52f9
|
@ -21,6 +21,7 @@ Sent: Enviado
|
||||||
Worker: Trabajador
|
Worker: Trabajador
|
||||||
Send: Enviar
|
Send: Enviar
|
||||||
Sample: Plantilla
|
Sample: Plantilla
|
||||||
|
Credit: Crédito
|
||||||
|
|
||||||
# Sections
|
# Sections
|
||||||
Clients: Clientes
|
Clients: Clientes
|
||||||
|
|
|
@ -6,3 +6,4 @@ Risk: Riesgo
|
||||||
Secured credit: Crédito asegurado
|
Secured credit: Crédito asegurado
|
||||||
Average invoiced: Consumo medio
|
Average invoiced: Consumo medio
|
||||||
Sales person: Comercial
|
Sales person: Comercial
|
||||||
|
Recovery: Recobro
|
|
@ -0,0 +1,46 @@
|
||||||
|
const app = require(`${servicesDir}/client/server/server`);
|
||||||
|
|
||||||
|
describe('client summary()', () => {
|
||||||
|
it('should return a summary object containing data', async() => {
|
||||||
|
let result = await app.models.Client.summary(101);
|
||||||
|
|
||||||
|
expect(result.id).toEqual(101);
|
||||||
|
expect(result.name).toEqual('Bruce Wayne');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return a summary object containing mana', async() => {
|
||||||
|
let result = await app.models.Client.summary(101);
|
||||||
|
|
||||||
|
expect(result.mana.mana).toEqual(260);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return a summary object containing debt', async() => {
|
||||||
|
let result = await app.models.Client.summary(101);
|
||||||
|
|
||||||
|
expect(result.debt.debt).toEqual(1389.9);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return a summary object containing averageInvoiced', async() => {
|
||||||
|
let result = await app.models.Client.summary(101);
|
||||||
|
|
||||||
|
expect(result.averageInvoiced.invoiced).toEqual(1500);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return a summary object containing totalGreuge', async() => {
|
||||||
|
let result = await app.models.Client.summary(101);
|
||||||
|
|
||||||
|
expect(result.totalGreuge).toEqual(203.71);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return a summary object without containing active recoveries', async() => {
|
||||||
|
let result = await app.models.Client.summary(101);
|
||||||
|
|
||||||
|
expect(result.recovery).toEqual(null);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return a summary object containing active recoveries', async() => {
|
||||||
|
let result = await app.models.Client.summary(102);
|
||||||
|
|
||||||
|
expect(result.recovery.id).toEqual(3);
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue