Merge branch 'dev' of https://git.verdnatura.es/salix into dev
This commit is contained in:
commit
56e868c3dd
|
@ -12,7 +12,6 @@ module.exports = function(Client) {
|
||||||
delete params.size;
|
delete params.size;
|
||||||
|
|
||||||
if (params.search) {
|
if (params.search) {
|
||||||
hasAnd = true;
|
|
||||||
filters.where.and = [
|
filters.where.and = [
|
||||||
{
|
{
|
||||||
or: [
|
or: [
|
||||||
|
|
|
@ -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));
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue