tests updated
This commit is contained in:
parent
054cf21c1f
commit
280803f2ad
|
@ -65,7 +65,7 @@ module.exports = Self => {
|
|||
}
|
||||
});
|
||||
|
||||
filter = mergeFilters(filter, {where});
|
||||
filter = mergeFilters(ctx.args.filter, {where});
|
||||
|
||||
let stmt = new ParameterizedSQL(
|
||||
`SELECT i.id, i.image, i.name, i.description,
|
||||
|
@ -86,9 +86,9 @@ module.exports = Self => {
|
|||
LEFT JOIN taxClass tc ON tc.id = i.taxClassFk`
|
||||
);
|
||||
|
||||
if (tags) {
|
||||
if (ctx.args.tags) {
|
||||
let i = 1;
|
||||
for (let tag of tags) {
|
||||
for (let tag of ctx.args.tags) {
|
||||
if (tag.value == null) continue;
|
||||
let tAlias = `it${i++}`;
|
||||
stmt.merge({
|
||||
|
|
|
@ -4,11 +4,10 @@ describe('item filter()', () => {
|
|||
it('should return 1 result using filter and tags', async() => {
|
||||
let filter = {
|
||||
order: 'isActive ASC, name',
|
||||
limit: 8,
|
||||
where: {and: [{typeFk: 2}]}
|
||||
limit: 8
|
||||
};
|
||||
let tags = [{value: 'Gem2', tagFk: 58}];
|
||||
let result = await app.models.Item.filter(filter, tags);
|
||||
let result = await app.models.Item.filter({args: {filter: filter, typeFk: 2, tags: tags}});
|
||||
|
||||
expect(result.length).toEqual(1);
|
||||
expect(result[0].id).toEqual(2);
|
||||
|
|
Loading…
Reference in New Issue