2018-02-27 13:55:59 +00:00
|
|
|
// const crudItemNiches = require('../crudItemNiches');
|
|
|
|
// const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors;
|
2018-02-20 11:25:51 +00:00
|
|
|
|
2018-02-27 13:55:59 +00:00
|
|
|
// 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']);
|
2018-02-20 11:25:51 +00:00
|
|
|
|
2018-02-27 13:55:59 +00:00
|
|
|
// crudItemNiches(self);
|
|
|
|
// self.crudItemNiches({
|
|
|
|
// delete: [1],
|
|
|
|
// create: [],
|
|
|
|
// update: []
|
|
|
|
// }).then(result => {
|
|
|
|
// expect(self.destroyAll).toHaveBeenCalledWith({id: {inq: [1]}});
|
|
|
|
// done();
|
|
|
|
// })
|
|
|
|
// .catch(catchErrors(done));
|
|
|
|
// });
|
2018-02-20 11:25:51 +00:00
|
|
|
|
2018-02-27 13:55:59 +00:00
|
|
|
// it('should call the create method if there are ids in create Array', done => {
|
|
|
|
// let self = jasmine.createSpyObj('self', ['remoteMethod', 'crudItemNiches', 'destroyAll', 'create', 'upsert']);
|
2018-02-20 11:25:51 +00:00
|
|
|
|
2018-02-27 13:55:59 +00:00
|
|
|
// crudItemNiches(self);
|
|
|
|
// self.crudItemNiches({
|
|
|
|
// delete: [],
|
|
|
|
// create: [1],
|
|
|
|
// update: []
|
|
|
|
// }).then(result => {
|
|
|
|
// expect(self.create).toHaveBeenCalledWith([1]);
|
|
|
|
// done();
|
|
|
|
// })
|
|
|
|
// .catch(catchErrors(done));
|
|
|
|
// });
|
2018-02-20 11:25:51 +00:00
|
|
|
|
2018-02-27 13:55:59 +00:00
|
|
|
// 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']);
|
2018-02-20 11:25:51 +00:00
|
|
|
|
2018-02-27 13:55:59 +00:00
|
|
|
// 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));
|
|
|
|
// });
|
|
|
|
// });
|