chore(): Further improve promotions computation (#13556)
* chore(): Further improve promotions * chore(): Further improve promotions * chore(): Further improve promotions * chore(): Further improve promotions * chore(): Further improve promotions * Create lazy-lemons-occur.md * chore(): Further improve promotions * WIP * fix * improve: * fix attribute tests * fix tests * union
This commit is contained in:
committed by
GitHub
parent
cb716856b6
commit
4c1c1dd4c0
File diff suppressed because it is too large
Load Diff
@@ -266,7 +266,7 @@ moduleIntegrationTestRunner({
|
||||
const createdPromotion = await createDefaultPromotion(service, {
|
||||
rules: [
|
||||
{
|
||||
attribute: "customer_group_id",
|
||||
attribute: "customer.customer_group.id",
|
||||
operator: "in",
|
||||
values: ["VIP", "top100"],
|
||||
},
|
||||
@@ -285,7 +285,7 @@ moduleIntegrationTestRunner({
|
||||
type: "standard",
|
||||
rules: [
|
||||
expect.objectContaining({
|
||||
attribute: "customer_group_id",
|
||||
attribute: "customer.customer_group.id",
|
||||
operator: "in",
|
||||
values: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
@@ -305,7 +305,7 @@ moduleIntegrationTestRunner({
|
||||
const createdPromotion = await createDefaultPromotion(service, {
|
||||
rules: [
|
||||
{
|
||||
attribute: "customer_group_id",
|
||||
attribute: "customer.customer_group.id",
|
||||
operator: "eq",
|
||||
values: "VIP",
|
||||
},
|
||||
@@ -324,7 +324,7 @@ moduleIntegrationTestRunner({
|
||||
type: "standard",
|
||||
rules: [
|
||||
expect.objectContaining({
|
||||
attribute: "customer_group_id",
|
||||
attribute: "customer.customer_group.id",
|
||||
operator: "eq",
|
||||
values: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
@@ -469,14 +469,14 @@ moduleIntegrationTestRunner({
|
||||
buy_rules_min_quantity: 1,
|
||||
buy_rules: [
|
||||
{
|
||||
attribute: "product_collection.id",
|
||||
attribute: "items.product_collection.id",
|
||||
operator: "eq",
|
||||
values: ["pcol_towel"],
|
||||
},
|
||||
],
|
||||
target_rules: [
|
||||
{
|
||||
attribute: "product.id",
|
||||
attribute: "items.product.id",
|
||||
operator: "eq",
|
||||
values: ["prod_mat"],
|
||||
},
|
||||
@@ -498,14 +498,14 @@ moduleIntegrationTestRunner({
|
||||
allocation: "each",
|
||||
buy_rules: [
|
||||
{
|
||||
attribute: "product_collection.id",
|
||||
attribute: "items.product_collection.id",
|
||||
operator: "eq",
|
||||
values: ["pcol_towel"],
|
||||
},
|
||||
],
|
||||
target_rules: [
|
||||
{
|
||||
attribute: "product.id",
|
||||
attribute: "items.product.id",
|
||||
operator: "eq",
|
||||
values: ["prod_mat"],
|
||||
},
|
||||
@@ -528,14 +528,14 @@ moduleIntegrationTestRunner({
|
||||
buy_rules_min_quantity: 1,
|
||||
buy_rules: [
|
||||
{
|
||||
attribute: "product_collection.id",
|
||||
attribute: "items.product_collection.id",
|
||||
operator: "eq",
|
||||
values: ["pcol_towel"],
|
||||
},
|
||||
],
|
||||
target_rules: [
|
||||
{
|
||||
attribute: "product.id",
|
||||
attribute: "items.product.id",
|
||||
operator: "eq",
|
||||
values: "prod_mat",
|
||||
},
|
||||
@@ -551,14 +551,14 @@ moduleIntegrationTestRunner({
|
||||
buy_rules_min_quantity: 1,
|
||||
target_rules: [
|
||||
expect.objectContaining({
|
||||
attribute: "product.id",
|
||||
attribute: "items.product.id",
|
||||
operator: "eq",
|
||||
values: [expect.objectContaining({ value: "prod_mat" })],
|
||||
}),
|
||||
],
|
||||
buy_rules: [
|
||||
expect.objectContaining({
|
||||
attribute: "product_collection.id",
|
||||
attribute: "items.product_collection.id",
|
||||
operator: "eq",
|
||||
values: [expect.objectContaining({ value: "pcol_towel" })],
|
||||
}),
|
||||
@@ -980,7 +980,7 @@ moduleIntegrationTestRunner({
|
||||
it("should successfully add rules to a promotion", async () => {
|
||||
const promotionRules = await service.addPromotionRules(promotion.id, [
|
||||
{
|
||||
attribute: "customer_group_id",
|
||||
attribute: "customer.customer_group.id",
|
||||
operator: "in",
|
||||
values: ["VIP", "top100"],
|
||||
},
|
||||
@@ -989,7 +989,7 @@ moduleIntegrationTestRunner({
|
||||
expect(promotionRules).toEqual([
|
||||
expect.objectContaining({
|
||||
id: promotionRules[0].id,
|
||||
attribute: "customer_group_id",
|
||||
attribute: "customer.customer_group.id",
|
||||
operator: "in",
|
||||
values: expect.arrayContaining([
|
||||
expect.objectContaining({ value: "VIP" }),
|
||||
@@ -1041,7 +1041,7 @@ moduleIntegrationTestRunner({
|
||||
promotion.id,
|
||||
[
|
||||
{
|
||||
attribute: "customer_group_id",
|
||||
attribute: "customer.customer_group.id",
|
||||
operator: "in",
|
||||
values: ["VIP", "top100"],
|
||||
},
|
||||
@@ -1051,7 +1051,7 @@ moduleIntegrationTestRunner({
|
||||
expect(promotionRules).toEqual([
|
||||
expect.objectContaining({
|
||||
id: promotionRules[0].id,
|
||||
attribute: "customer_group_id",
|
||||
attribute: "customer.customer_group.id",
|
||||
operator: "in",
|
||||
values: expect.arrayContaining([
|
||||
expect.objectContaining({ value: "VIP" }),
|
||||
@@ -1075,14 +1075,14 @@ moduleIntegrationTestRunner({
|
||||
buy_rules_min_quantity: 1,
|
||||
buy_rules: [
|
||||
{
|
||||
attribute: "product_collection.id",
|
||||
attribute: "items.product_collection.id",
|
||||
operator: "eq",
|
||||
values: ["pcol_towel"],
|
||||
},
|
||||
],
|
||||
target_rules: [
|
||||
{
|
||||
attribute: "product.id",
|
||||
attribute: "items.product.id",
|
||||
operator: "in",
|
||||
values: ["prod_1", "prod_2"],
|
||||
},
|
||||
@@ -1125,7 +1125,7 @@ moduleIntegrationTestRunner({
|
||||
promotion.id,
|
||||
[
|
||||
{
|
||||
attribute: "product.id",
|
||||
attribute: "items.product.id",
|
||||
operator: "in",
|
||||
values: ["prod_3", "prod_4"],
|
||||
},
|
||||
@@ -1135,7 +1135,7 @@ moduleIntegrationTestRunner({
|
||||
expect(promotionRules).toEqual([
|
||||
expect.objectContaining({
|
||||
id: promotionRules[0].id,
|
||||
attribute: "product.id",
|
||||
attribute: "items.product.id",
|
||||
operator: "in",
|
||||
values: expect.arrayContaining([
|
||||
expect.objectContaining({ value: "prod_3" }),
|
||||
@@ -1153,7 +1153,7 @@ moduleIntegrationTestRunner({
|
||||
promotion = await createDefaultPromotion(service, {
|
||||
rules: [
|
||||
{
|
||||
attribute: "customer_group_id",
|
||||
attribute: "customer.customer_group.id",
|
||||
operator: "in",
|
||||
values: ["VIP", "top100"],
|
||||
},
|
||||
@@ -1219,7 +1219,7 @@ moduleIntegrationTestRunner({
|
||||
application_method: {
|
||||
target_rules: [
|
||||
{
|
||||
attribute: "customer_group_id",
|
||||
attribute: "customer.customer_group.id",
|
||||
operator: "in",
|
||||
values: ["VIP", "top100"],
|
||||
},
|
||||
@@ -1295,14 +1295,14 @@ moduleIntegrationTestRunner({
|
||||
buy_rules_min_quantity: 1,
|
||||
target_rules: [
|
||||
{
|
||||
attribute: "product.id",
|
||||
attribute: "items.product.id",
|
||||
operator: "in",
|
||||
values: ["prod_1", "prod_2"],
|
||||
},
|
||||
],
|
||||
buy_rules: [
|
||||
{
|
||||
attribute: "product_collection",
|
||||
attribute: "items.product_collection.id",
|
||||
operator: "eq",
|
||||
values: ["pcol_towel"],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user