// const crudItemNiches = require('../crudItemNiches'); // const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors; // describe('Item crudItemNiches()', () => { // it('should call the destroyAll method if there are ids in delete Array', done => { // let self = jasmine.createSpyObj('self', ['remoteMethod', 'crudItemNiches', 'destroyAll', 'create', 'upsert']); // crudItemNiches(self); // self.crudItemNiches({ // delete: [1], // create: [], // update: [] // }).then(result => { // expect(self.destroyAll).toHaveBeenCalledWith({id: {inq: [1]}}); // done(); // }) // .catch(catchErrors(done)); // }); // it('should call the create method if there are ids in create Array', done => { // let self = jasmine.createSpyObj('self', ['remoteMethod', 'crudItemNiches', 'destroyAll', 'create', 'upsert']); // crudItemNiches(self); // self.crudItemNiches({ // delete: [], // create: [1], // update: [] // }).then(result => { // expect(self.create).toHaveBeenCalledWith([1]); // done(); // }) // .catch(catchErrors(done)); // }); // it('should call the upsert method as many times as ids in update Array', done => { // let self = jasmine.createSpyObj('self', ['remoteMethod', 'crudItemNiches', 'destroyAll', 'create', 'upsert']); // crudItemNiches(self); // self.crudItemNiches({ // delete: [], // create: [], // update: [1, 2] // }).then(result => { // expect(self.upsert).toHaveBeenCalledWith(1); // expect(self.upsert).toHaveBeenCalledWith(2); // expect(self.upsert.calls.count()).toEqual(2); // done(); // }) // .catch(catchErrors(done)); // }); // });