22 lines
770 B
JavaScript
22 lines
770 B
JavaScript
const app = require('vn-loopback/server/server');
|
|
|
|
describe('Worker activeWithRole', () => {
|
|
it('should return the sales people as result', async() => {
|
|
const filter = {where: {role: 'salesPerson'}};
|
|
const result = await app.models.Worker.activeWithRole(filter);
|
|
const firstWorker = result[0];
|
|
|
|
expect(result.length).toEqual(1);
|
|
expect(firstWorker.nickname).toEqual('salesPersonNick');
|
|
});
|
|
|
|
it('should return the buyers as result', async() => {
|
|
const filter = {where: {role: 'buyer'}};
|
|
const result = await app.models.Worker.activeWithRole(filter);
|
|
const firstWorker = result[0];
|
|
|
|
expect(result.length).toEqual(1);
|
|
expect(firstWorker.nickname).toEqual('buyerNick');
|
|
});
|
|
});
|