Merge branch 'dev' of https://git.verdnatura.es/salix into dev

This commit is contained in:
Daniel Herrero 2018-01-25 13:37:40 +01:00
commit 56e868c3dd
2 changed files with 18 additions and 1 deletions

View File

@ -12,7 +12,6 @@ module.exports = function(Client) {
delete params.size;
if (params.search) {
hasAnd = true;
filters.where.and = [
{
or: [

View File

@ -0,0 +1,18 @@
import filter from '../filter';
describe('Greuge filterClients()', () => {
it('should call the filterClients method', () => {
let params = {
page: 1,
size: 1,
search: 'Bruce Wayne',
phone: 555555555
};
let expectedResponse = {where: {and: [{or: [{id: 'Bruce Wayne'}, {name: {regexp: 'Bruce Wayne'}}]}, {or: [{phone: 555555555}, {mobile: 555555555}]}]}, skip: 0, limit: 1};
let client = jasmine.createSpyObj('client', ['installMethod']);
filter(client);
let filterClients = client.installMethod.calls.allArgs()[0][1];
expect(Object.keys(filterClients(params))).toEqual(Object.keys(expectedResponse));
});
});