This commit is contained in:
parent
54f65a9227
commit
9a86929e3a
|
@ -0,0 +1,25 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
|
||||
describe('worker filter()', () => {
|
||||
it('should return 1 result filtering by id', async() => {
|
||||
let result = await app.models.Worker.filter({args: {filter: {}, search: 1}});
|
||||
|
||||
expect(result.length).toEqual(1);
|
||||
expect(result[0].id).toEqual(1);
|
||||
});
|
||||
|
||||
it('should return 1 result filtering by string', async() => {
|
||||
let result = await app.models.Worker.filter({args: {filter: {}, search: 'administrativeNick'}});
|
||||
|
||||
expect(result.length).toEqual(1);
|
||||
expect(result[0].id).toEqual(5);
|
||||
});
|
||||
|
||||
it('should return 2 results filtering by name', async() => {
|
||||
let result = await app.models.Worker.filter({args: {filter: {}, name: 'agency'}});
|
||||
|
||||
expect(result.length).toEqual(2);
|
||||
expect(result[0].nickname).toEqual('agencyNick');
|
||||
expect(result[1].nickname).toEqual('agencyBossNick');
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue