From ce3e299d09701a34144d8b46151d65eb34fb5173 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 18 Apr 2023 08:20:50 +0200 Subject: [PATCH 1/2] fix intermintent test --- .../item/back/methods/fixed-price/specs/editFixedPrice.spec.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/item/back/methods/fixed-price/specs/editFixedPrice.spec.js b/modules/item/back/methods/fixed-price/specs/editFixedPrice.spec.js index 9c265f28a..380919e64 100644 --- a/modules/item/back/methods/fixed-price/specs/editFixedPrice.spec.js +++ b/modules/item/back/methods/fixed-price/specs/editFixedPrice.spec.js @@ -38,6 +38,7 @@ describe('Item editFixedPrice()', () => { try { const filter = {'it.categoryFk': 1}; + const secondFilter = {where: {'it.categoryFk': 1}}; const ctx = { args: { filter: filter @@ -50,7 +51,7 @@ describe('Item editFixedPrice()', () => { await models.FixedPrice.editFixedPrice(ctx, field, newValue, null, filter, options); - const [result] = await models.FixedPrice.filter(ctx, filter, options); + const [result] = await models.FixedPrice.filter(ctx, secondFilter, options); expect(result[field]).toEqual(newValue); From edc49ab5b323bfd175b79a05ab8b958cbaa1cfe6 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 18 Apr 2023 08:26:26 +0200 Subject: [PATCH 2/2] refactor code --- .../back/methods/fixed-price/specs/editFixedPrice.spec.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/item/back/methods/fixed-price/specs/editFixedPrice.spec.js b/modules/item/back/methods/fixed-price/specs/editFixedPrice.spec.js index 380919e64..db255a91e 100644 --- a/modules/item/back/methods/fixed-price/specs/editFixedPrice.spec.js +++ b/modules/item/back/methods/fixed-price/specs/editFixedPrice.spec.js @@ -37,8 +37,7 @@ describe('Item editFixedPrice()', () => { const options = {transaction: tx}; try { - const filter = {'it.categoryFk': 1}; - const secondFilter = {where: {'it.categoryFk': 1}}; + const filter = {where: {'it.categoryFk': 1}}; const ctx = { args: { filter: filter @@ -49,9 +48,9 @@ describe('Item editFixedPrice()', () => { const field = 'rate2'; const newValue = 88; - await models.FixedPrice.editFixedPrice(ctx, field, newValue, null, filter, options); + await models.FixedPrice.editFixedPrice(ctx, field, newValue, null, filter.where, options); - const [result] = await models.FixedPrice.filter(ctx, secondFilter, options); + const [result] = await models.FixedPrice.filter(ctx, filter, options); expect(result[field]).toEqual(newValue);