Updated unit test
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
312faeb3b0
commit
f8ea14ecab
|
@ -42,7 +42,7 @@ describe('Order', () => {
|
|||
|
||||
describe('items() setter', () => {
|
||||
it(`should return an object with order params`, () => {
|
||||
jest.spyOn(controller, 'buildTagsFilter');
|
||||
jest.spyOn(controller, 'fetchResultTags');
|
||||
jest.spyOn(controller, 'buildOrderFilter');
|
||||
|
||||
const expectedResult = [{field: 'showOrder, price', name: 'Color and price', priority: 999}];
|
||||
|
@ -54,8 +54,8 @@ describe('Order', () => {
|
|||
|
||||
expect(controller.orderFields.length).toEqual(6);
|
||||
expect(controller.orderFields).toEqual(jasmine.arrayContaining(expectedResult));
|
||||
expect(controller.buildTagsFilter).toHaveBeenCalledWith(items);
|
||||
expect(controller.buildOrderFilter).toHaveBeenCalledWith(items);
|
||||
expect(controller.fetchResultTags).toHaveBeenCalledWith(items);
|
||||
expect(controller.buildOrderFilter).toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -270,8 +270,8 @@ describe('Order', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('buildTagsFilter()', () => {
|
||||
it(`should create an array of non repeated tag values and then set the tagValues property`, () => {
|
||||
describe('fetchResultTags()', () => {
|
||||
it(`should create an array of non repeated tags then set the resultTags property`, () => {
|
||||
const items = [
|
||||
{
|
||||
id: 1, name: 'My Item 1', tags: [
|
||||
|
@ -285,9 +285,9 @@ describe('Order', () => {
|
|||
{tagFk: 5, name: 'Color', value: 'blue'}
|
||||
]
|
||||
}];
|
||||
controller.buildTagsFilter(items);
|
||||
controller.fetchResultTags(items);
|
||||
|
||||
expect(controller.tagValues.length).toEqual(3);
|
||||
expect(controller.resultTags.length).toEqual(2);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -306,7 +306,9 @@ describe('Order', () => {
|
|||
{tagFk: 6, name: 'Relevancy'}
|
||||
]
|
||||
}];
|
||||
controller.buildOrderFilter(items);
|
||||
|
||||
controller.fetchResultTags(items);
|
||||
controller.buildOrderFilter();
|
||||
|
||||
expect(controller.orderFields.length).toEqual(7);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue