2018-08-22 11:28:01 +00:00
|
|
|
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);
|
|
|
|
|
2018-09-04 12:52:38 +00:00
|
|
|
expect(result.mana.mana).toEqual(400);
|
2018-08-22 11:28:01 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should return a summary object containing debt', async() => {
|
|
|
|
let result = await app.models.Client.summary(101);
|
|
|
|
|
2018-09-11 13:09:15 +00:00
|
|
|
expect(result.debt.debt).toEqual(1048.76);
|
2018-08-22 11:28:01 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
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);
|
|
|
|
});
|
|
|
|
});
|