tests fixed
This commit is contained in:
parent
78ac80ad72
commit
11c5240834
|
@ -24,7 +24,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
Self.activeWorkersWithRole = async filter => {
|
Self.activeWorkersWithRole = async filter => {
|
||||||
let conn = Self.dataSource.connector;
|
let conn = Self.dataSource.connector;
|
||||||
if (filter.where.and && Array.isArray(filter.where.and)) {
|
if (filter.where && filter.where.and && Array.isArray(filter.where.and)) {
|
||||||
let where = {};
|
let where = {};
|
||||||
filter.where.and.forEach(element => {
|
filter.where.and.forEach(element => {
|
||||||
where[Object.keys(element)[0]] = Object.values(element)[0];
|
where[Object.keys(element)[0]] = Object.values(element)[0];
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
const app = require(`${servicesDir}/client/server/server`);
|
|
||||||
|
|
||||||
describe('Client activeBuyer', () => {
|
|
||||||
it('should return the buyers as result', async () => {
|
|
||||||
let filter = {};
|
|
||||||
let result = await app.models.Client.activeBuyer(filter);
|
|
||||||
|
|
||||||
let isBuyer = await app.models.Account.hasRole(result[0].id, 'buyer');
|
|
||||||
|
|
||||||
expect(result.length).toEqual(9);
|
|
||||||
expect(isBuyer).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,13 +0,0 @@
|
||||||
const app = require(`${servicesDir}/client/server/server`);
|
|
||||||
|
|
||||||
describe('Client activeSalesPerson', () => {
|
|
||||||
it('should return the sales people as result', async () => {
|
|
||||||
let filter = {};
|
|
||||||
let result = await app.models.Client.activeSalesPerson(filter);
|
|
||||||
|
|
||||||
let isSalesPerson = await app.models.Account.hasRole(result[0].id, 'salesPerson');
|
|
||||||
|
|
||||||
expect(result.length).toEqual(10);
|
|
||||||
expect(isSalesPerson).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
const app = require(`${servicesDir}/client/server/server`);
|
||||||
|
|
||||||
|
describe('Client activeWorkersWithRole', () => {
|
||||||
|
it('should return the sales people as result', async () => {
|
||||||
|
let filter = {where: {role: 'salesPerson'}};
|
||||||
|
let result = await app.models.Client.activeWorkersWithRole(filter);
|
||||||
|
|
||||||
|
let isSalesPerson = await app.models.Account.hasRole(result[0].id, 'salesPerson');
|
||||||
|
|
||||||
|
expect(result.length).toEqual(10);
|
||||||
|
expect(isSalesPerson).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return the buyers as result', async () => {
|
||||||
|
let filter = {where: {role: 'buyer'}};
|
||||||
|
let result = await app.models.Client.activeWorkersWithRole(filter);
|
||||||
|
|
||||||
|
let isBuyer = await app.models.Account.hasRole(result[0].id, 'buyer');
|
||||||
|
|
||||||
|
expect(result.length).toEqual(9);
|
||||||
|
expect(isBuyer).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue