Updated unit tests
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
76ec1fceae
commit
9790f0cdb1
|
@ -80,6 +80,45 @@ describe('Component smartTable', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('defaultOrder', () => {
|
||||
it('should insert a new object to the controller sortCriteria with a sortType value of "ASC"', () => {
|
||||
const element = document.createElement('div');
|
||||
controller.model = {order: 'id'};
|
||||
controller.columns = [
|
||||
{field: 'id', element: element},
|
||||
{field: 'test1', element: element},
|
||||
{field: 'test2', element: element}
|
||||
];
|
||||
|
||||
controller.defaultOrder();
|
||||
|
||||
const firstSortCriteria = controller.sortCriteria[0];
|
||||
|
||||
expect(firstSortCriteria.field).toEqual('id');
|
||||
expect(firstSortCriteria.sortType).toEqual('ASC');
|
||||
});
|
||||
|
||||
it('should insert two new objects to the controller sortCriteria with a sortType values of "ASC" and "DESC"', () => {
|
||||
const element = document.createElement('div');
|
||||
controller.model = {order: 'test1, id DESC'};
|
||||
controller.columns = [
|
||||
{field: 'id', element: element},
|
||||
{field: 'test1', element: element},
|
||||
{field: 'test2', element: element}
|
||||
];
|
||||
|
||||
controller.defaultOrder();
|
||||
|
||||
const firstSortCriteria = controller.sortCriteria[0];
|
||||
const secondSortCriteria = controller.sortCriteria[1];
|
||||
|
||||
expect(firstSortCriteria.field).toEqual('test1');
|
||||
expect(firstSortCriteria.sortType).toEqual('ASC');
|
||||
expect(secondSortCriteria.field).toEqual('id');
|
||||
expect(secondSortCriteria.sortType).toEqual('DESC');
|
||||
});
|
||||
});
|
||||
|
||||
describe('addFilter()', () => {
|
||||
it('should call the model addFilter() with a basic where filter if exprBuilder() was not received', () => {
|
||||
controller.model = {addFilter: jest.fn()};
|
||||
|
|
Loading…
Reference in New Issue