fix: frontTest
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Vicent Llopis 2023-02-02 11:34:13 +01:00
parent 76865fc7b6
commit 15429293dd
1 changed files with 2 additions and 6 deletions

View File

@ -160,7 +160,7 @@ describe('Component smartTable', () => {
describe('applySort()', () => {
it('should call the $state go and model refresh without making changes on the model order', () => {
controller.$state = {
go: jest.fn(),
go: jest.fn().mockReturnValue(new Promise(resolve => resolve())),
current: {
name: 'section'
}
@ -171,13 +171,12 @@ describe('Component smartTable', () => {
expect(controller.model.order).toBeUndefined();
expect(controller.$state.go).toHaveBeenCalled();
expect(controller.refresh).toHaveBeenCalled();
});
it('should call the $state go and model refresh after setting model order according to the controller sortCriteria', () => {
const orderBy = {field: 'myField', sortType: 'ASC'};
controller.$state = {
go: jest.fn(),
go: jest.fn().mockReturnValue(new Promise(resolve => resolve())),
current: {
name: 'section'
}
@ -190,7 +189,6 @@ describe('Component smartTable', () => {
expect(controller.model.order).toEqual(`${orderBy.field} ${orderBy.sortType}`);
expect(controller.$state.go).toHaveBeenCalled();
expect(controller.refresh).toHaveBeenCalled();
});
});
@ -293,12 +291,10 @@ describe('Component smartTable', () => {
controller.$inputsScope = {
searchProps: {}
};
jest.spyOn(controller, 'refresh');
controller.defaultFilter();
expect(controller.model.addFilter).toHaveBeenCalled();
expect(controller.refresh).toHaveBeenCalled();
});
});