catalogFilter back test
This commit is contained in:
parent
fa31010069
commit
8feba9f5eb
|
@ -27,8 +27,9 @@ class Controller {
|
|||
name: $translate.instant('Descendant price')
|
||||
}
|
||||
];
|
||||
this.orderBy = this.orderList[0].order;
|
||||
this.filter = {
|
||||
order: this.orderList[0].order
|
||||
order: this.orderBy
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -3,15 +3,37 @@ const app = require(`${servicesDir}/order/server/server`);
|
|||
describe('order catalogFilter()', () => {
|
||||
it('should return an array of items', async() => {
|
||||
let filter = {
|
||||
orderFk: 1,
|
||||
where: {
|
||||
typeFk: 1
|
||||
}
|
||||
order: 'relevancy DESC, name'
|
||||
};
|
||||
let result = await app.models.Order.catalogFilter(filter);
|
||||
let args = {
|
||||
orderFk: 4,
|
||||
categoryFk: 1,
|
||||
typeFk: 2
|
||||
};
|
||||
|
||||
let tags = [];
|
||||
let result = await app.models.Order.catalogFilter(filter, args, tags);
|
||||
let firstItemId = result[0].id;
|
||||
|
||||
expect(result.length).toEqual(2);
|
||||
expect(firstItemId).toEqual(3);
|
||||
expect(firstItemId).toEqual(1);
|
||||
});
|
||||
|
||||
it('should return an array of items based on tag filter', async() => {
|
||||
let filter = {
|
||||
order: 'relevancy DESC, name'
|
||||
};
|
||||
let args = {
|
||||
orderFk: 4,
|
||||
categoryFk: 1,
|
||||
typeFk: 2
|
||||
};
|
||||
|
||||
let tags = [{tagFk: 56, value: 'Object2'}];
|
||||
let result = await app.models.Order.catalogFilter(filter, args, tags);
|
||||
let firstItemId = result[0].id;
|
||||
|
||||
expect(result.length).toEqual(1);
|
||||
expect(firstItemId).toEqual(2);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue