fix crud model test
gitea/salix/1970-test_crud_model This commit looks good Details

This commit is contained in:
Bernat Exposito Domenech 2020-02-26 08:57:51 +01:00
parent 9cad13f166
commit 020fd30243
1 changed files with 5 additions and 3 deletions

View File

@ -181,29 +181,31 @@ describe('Component vnCrudModel', () => {
it('should check onRequestEnd is called, moreRows is true and currentFilter is undefined when append is true', () => {
spyOn(controller, 'onRequestEnd');
const append = true;
const json = {data: [
{
id: 1,
name: 'test'
}]};
const filter = {limit: 1};
controller.onRemoteDone(json, filter, true);
controller.onRemoteDone(json, filter, append);
expect(controller.moreRows).toBe(true);
expect(controller.filter).toBeUndefined();
expect(controller.currentFilter).toBeUndefined();
expect(controller.onRequestEnd).toHaveBeenCalledWith();
});
it('should check onRequestEnd is called, moreRows is true and currentFilter is defined when append is false', () => {
spyOn(controller, 'onRequestEnd');
const append = false;
const json = {data: [
{
id: 1,
name: 'test'
}]};
const filter = {limit: 1};
controller.onRemoteDone(json, filter, false);
controller.onRemoteDone(json, filter, append);
expect(controller.moreRows).toBe(true);
expect(controller.currentFilter).toBe(filter);