feat: Implement PriceList and extend MoneyAmount (#1152)
* init * added buld id validation to repo * admin done * updated price reqs * intial implementation of PriceList * integration tests for price lists * updated admin/product integration tests * update updateVariantPrices method * remove comment from error handler * add integration test for batch deleting prices associated with price list * make update to prices through variant service limited to default prices * update store/products.js snapshot * add api unit tests and update product integration tests to validate that prices from Price List are ignored * fix product test * requested changes * cascade * ensure delete variant cascades to MoneyAmount * addresses PR feedback * removed unused endpoint * update mock * fix failing store integration tests * remove medusajs ressource * re add env.template * Update integration-tests/api/__tests__/admin/price-list.js Co-authored-by: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com> * Update integration-tests/api/__tests__/admin/price-list.js Co-authored-by: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com> * fix: update snapshots Co-authored-by: Sebastian Rindom <skrindom@gmail.com> Co-authored-by: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
23f8399c16
commit
5300926db8
@@ -0,0 +1,293 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`/admin/price-lists GET /admin/price-lists returns a price list by :id 1`] = `
|
||||
Object {
|
||||
"created_at": Any<String>,
|
||||
"customer_groups": Array [],
|
||||
"deleted_at": null,
|
||||
"description": "Winter sale for VIP customers. 25% off selected items.",
|
||||
"ends_at": "2022-07-31T00:00:00.000Z",
|
||||
"id": Any<String>,
|
||||
"name": "VIP winter sale",
|
||||
"prices": Array [
|
||||
Object {
|
||||
"amount": 100,
|
||||
"created_at": Any<String>,
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": Any<String>,
|
||||
"max_quantity": 100,
|
||||
"min_quantity": 1,
|
||||
"price_list_id": "pl_no_customer_groups",
|
||||
"region_id": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": "test-variant",
|
||||
},
|
||||
Object {
|
||||
"amount": 80,
|
||||
"created_at": Any<String>,
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": Any<String>,
|
||||
"max_quantity": 500,
|
||||
"min_quantity": 101,
|
||||
"price_list_id": "pl_no_customer_groups",
|
||||
"region_id": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": "test-variant",
|
||||
},
|
||||
Object {
|
||||
"amount": 50,
|
||||
"created_at": Any<String>,
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": Any<String>,
|
||||
"max_quantity": 1000,
|
||||
"min_quantity": 501,
|
||||
"price_list_id": "pl_no_customer_groups",
|
||||
"region_id": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": "test-variant",
|
||||
},
|
||||
],
|
||||
"starts_at": "2022-07-01T00:00:00.000Z",
|
||||
"status": "active",
|
||||
"type": "sale",
|
||||
"updated_at": Any<String>,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`/admin/price-lists POST /admin/price-lists/:id updates a price list 1`] = `
|
||||
Object {
|
||||
"created_at": Any<String>,
|
||||
"customer_groups": Array [
|
||||
Object {
|
||||
"created_at": Any<String>,
|
||||
"deleted_at": null,
|
||||
"id": "customer-group-1",
|
||||
"metadata": null,
|
||||
"name": "vip-customers",
|
||||
"updated_at": Any<String>,
|
||||
},
|
||||
],
|
||||
"deleted_at": null,
|
||||
"description": "Winter sale for our most loyal customers",
|
||||
"ends_at": "2022-12-31T00:00:00.000Z",
|
||||
"id": "pl_no_customer_groups",
|
||||
"name": "Loyalty Reward - Winter Sale",
|
||||
"prices": Array [
|
||||
Object {
|
||||
"amount": 100,
|
||||
"created_at": Any<String>,
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": Any<String>,
|
||||
"max_quantity": 100,
|
||||
"min_quantity": 1,
|
||||
"price_list_id": "pl_no_customer_groups",
|
||||
"region_id": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": "test-variant",
|
||||
},
|
||||
Object {
|
||||
"amount": 80,
|
||||
"created_at": Any<String>,
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": Any<String>,
|
||||
"max_quantity": 500,
|
||||
"min_quantity": 101,
|
||||
"price_list_id": "pl_no_customer_groups",
|
||||
"region_id": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": "test-variant",
|
||||
},
|
||||
Object {
|
||||
"amount": 50,
|
||||
"created_at": Any<String>,
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": Any<String>,
|
||||
"max_quantity": 1000,
|
||||
"min_quantity": 501,
|
||||
"price_list_id": "pl_no_customer_groups",
|
||||
"region_id": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": "test-variant",
|
||||
},
|
||||
Object {
|
||||
"amount": 85,
|
||||
"created_at": Any<String>,
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": Any<String>,
|
||||
"max_quantity": null,
|
||||
"min_quantity": null,
|
||||
"price_list_id": "pl_no_customer_groups",
|
||||
"region_id": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": "test-variant_1",
|
||||
},
|
||||
Object {
|
||||
"amount": 10,
|
||||
"created_at": Any<String>,
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": Any<String>,
|
||||
"max_quantity": null,
|
||||
"min_quantity": null,
|
||||
"price_list_id": "pl_no_customer_groups",
|
||||
"region_id": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": "test-variant",
|
||||
},
|
||||
],
|
||||
"starts_at": "2022-09-01T00:00:00.000Z",
|
||||
"status": "draft",
|
||||
"type": "sale",
|
||||
"updated_at": Any<String>,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`/admin/price-lists POST /admin/price-lists/:id updates the amount and currency of a price in the price list 1`] = `
|
||||
Object {
|
||||
"amount": 250,
|
||||
"created_at": Any<String>,
|
||||
"currency_code": "eur",
|
||||
"deleted_at": null,
|
||||
"id": "ma_test_1",
|
||||
"max_quantity": 100,
|
||||
"min_quantity": 1,
|
||||
"price_list_id": "pl_no_customer_groups",
|
||||
"region_id": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": "test-variant",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`/admin/price-lists POST /admin/price-lists/:id/prices/batch Adds a batch of new prices to a price list overriding existing prices 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"amount": 45,
|
||||
"created_at": Any<String>,
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": Any<String>,
|
||||
"max_quantity": 2000,
|
||||
"min_quantity": 1001,
|
||||
"price_list_id": "pl_no_customer_groups",
|
||||
"region_id": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": "test-variant",
|
||||
},
|
||||
Object {
|
||||
"amount": 35,
|
||||
"created_at": Any<String>,
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": Any<String>,
|
||||
"max_quantity": 3000,
|
||||
"min_quantity": 2001,
|
||||
"price_list_id": "pl_no_customer_groups",
|
||||
"region_id": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": "test-variant",
|
||||
},
|
||||
Object {
|
||||
"amount": 25,
|
||||
"created_at": Any<String>,
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": Any<String>,
|
||||
"max_quantity": 4000,
|
||||
"min_quantity": 3001,
|
||||
"price_list_id": "pl_no_customer_groups",
|
||||
"region_id": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": "test-variant",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`/admin/price-lists POST /admin/price-lists/:id/prices/batch Adds a batch of new prices to a price list without overriding existing prices 1`] = `
|
||||
Array [
|
||||
Object {
|
||||
"amount": 100,
|
||||
"created_at": Any<String>,
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": Any<String>,
|
||||
"max_quantity": 100,
|
||||
"min_quantity": 1,
|
||||
"price_list_id": "pl_no_customer_groups",
|
||||
"region_id": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": "test-variant",
|
||||
},
|
||||
Object {
|
||||
"amount": 80,
|
||||
"created_at": Any<String>,
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": Any<String>,
|
||||
"max_quantity": 500,
|
||||
"min_quantity": 101,
|
||||
"price_list_id": "pl_no_customer_groups",
|
||||
"region_id": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": "test-variant",
|
||||
},
|
||||
Object {
|
||||
"amount": 50,
|
||||
"created_at": Any<String>,
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": Any<String>,
|
||||
"max_quantity": 1000,
|
||||
"min_quantity": 501,
|
||||
"price_list_id": "pl_no_customer_groups",
|
||||
"region_id": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": "test-variant",
|
||||
},
|
||||
Object {
|
||||
"amount": 45,
|
||||
"created_at": Any<String>,
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": Any<String>,
|
||||
"max_quantity": 2000,
|
||||
"min_quantity": 1001,
|
||||
"price_list_id": "pl_no_customer_groups",
|
||||
"region_id": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": "test-variant",
|
||||
},
|
||||
Object {
|
||||
"amount": 35,
|
||||
"created_at": Any<String>,
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": Any<String>,
|
||||
"max_quantity": 3000,
|
||||
"min_quantity": 2001,
|
||||
"price_list_id": "pl_no_customer_groups",
|
||||
"region_id": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": "test-variant",
|
||||
},
|
||||
Object {
|
||||
"amount": 25,
|
||||
"created_at": Any<String>,
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": Any<String>,
|
||||
"max_quantity": 4000,
|
||||
"min_quantity": 3001,
|
||||
"price_list_id": "pl_no_customer_groups",
|
||||
"region_id": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": "test-variant",
|
||||
},
|
||||
]
|
||||
`;
|
||||
@@ -110,8 +110,10 @@ Array [
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": StringMatching /\\^test-price\\*/,
|
||||
"max_quantity": null,
|
||||
"min_quantity": null,
|
||||
"price_list_id": null,
|
||||
"region_id": null,
|
||||
"sale_amount": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": StringMatching /\\^test-variant\\*/,
|
||||
},
|
||||
@@ -159,8 +161,10 @@ Array [
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": StringMatching /\\^test-price\\*/,
|
||||
"max_quantity": null,
|
||||
"min_quantity": null,
|
||||
"price_list_id": null,
|
||||
"region_id": null,
|
||||
"sale_amount": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": StringMatching /\\^test-variant\\*/,
|
||||
},
|
||||
@@ -208,8 +212,10 @@ Array [
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": StringMatching /\\^test-price\\*/,
|
||||
"max_quantity": null,
|
||||
"min_quantity": null,
|
||||
"price_list_id": null,
|
||||
"region_id": null,
|
||||
"sale_amount": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": StringMatching /\\^test-variant\\*/,
|
||||
},
|
||||
@@ -315,8 +321,10 @@ Array [
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": StringMatching /\\^test-price\\*/,
|
||||
"max_quantity": null,
|
||||
"min_quantity": null,
|
||||
"price_list_id": null,
|
||||
"region_id": null,
|
||||
"sale_amount": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": StringMatching /\\^test-variant\\*/,
|
||||
},
|
||||
@@ -364,8 +372,10 @@ Array [
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": StringMatching /\\^test-price\\*/,
|
||||
"max_quantity": null,
|
||||
"min_quantity": null,
|
||||
"price_list_id": null,
|
||||
"region_id": "test-region",
|
||||
"sale_amount": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": StringMatching /\\^test-variant\\*/,
|
||||
},
|
||||
@@ -561,8 +571,10 @@ Array [
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": Any<String>,
|
||||
"max_quantity": null,
|
||||
"min_quantity": null,
|
||||
"price_list_id": null,
|
||||
"region_id": null,
|
||||
"sale_amount": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": StringMatching /\\^variant_\\*/,
|
||||
},
|
||||
@@ -581,3 +593,318 @@ Array [
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`/admin/products POST /admin/products creates a product 1`] = `
|
||||
Object {
|
||||
"collection": Object {
|
||||
"created_at": Any<String>,
|
||||
"deleted_at": null,
|
||||
"handle": "test-collection",
|
||||
"id": "test-collection",
|
||||
"metadata": null,
|
||||
"title": "Test collection",
|
||||
"updated_at": Any<String>,
|
||||
},
|
||||
"collection_id": "test-collection",
|
||||
"created_at": Any<String>,
|
||||
"deleted_at": null,
|
||||
"description": "test-product-description",
|
||||
"discountable": true,
|
||||
"external_id": null,
|
||||
"handle": "test",
|
||||
"height": null,
|
||||
"hs_code": null,
|
||||
"id": StringMatching /\\^prod_\\*/,
|
||||
"images": Array [
|
||||
Object {
|
||||
"created_at": Any<String>,
|
||||
"deleted_at": null,
|
||||
"id": Any<String>,
|
||||
"metadata": null,
|
||||
"updated_at": Any<String>,
|
||||
"url": "test-image.png",
|
||||
},
|
||||
Object {
|
||||
"created_at": Any<String>,
|
||||
"deleted_at": null,
|
||||
"id": Any<String>,
|
||||
"metadata": null,
|
||||
"updated_at": Any<String>,
|
||||
"url": "test-image-2.png",
|
||||
},
|
||||
],
|
||||
"is_giftcard": false,
|
||||
"length": null,
|
||||
"material": null,
|
||||
"metadata": null,
|
||||
"mid_code": null,
|
||||
"options": Array [
|
||||
Object {
|
||||
"created_at": Any<String>,
|
||||
"deleted_at": null,
|
||||
"id": StringMatching /\\^opt_\\*/,
|
||||
"metadata": null,
|
||||
"product_id": StringMatching /\\^prod_\\*/,
|
||||
"title": "size",
|
||||
"updated_at": Any<String>,
|
||||
},
|
||||
Object {
|
||||
"created_at": Any<String>,
|
||||
"deleted_at": null,
|
||||
"id": StringMatching /\\^opt_\\*/,
|
||||
"metadata": null,
|
||||
"product_id": StringMatching /\\^prod_\\*/,
|
||||
"title": "color",
|
||||
"updated_at": Any<String>,
|
||||
},
|
||||
],
|
||||
"origin_country": null,
|
||||
"profile_id": StringMatching /\\^sp_\\*/,
|
||||
"status": "draft",
|
||||
"subtitle": null,
|
||||
"tags": Array [
|
||||
Object {
|
||||
"created_at": Any<String>,
|
||||
"deleted_at": null,
|
||||
"id": Any<String>,
|
||||
"metadata": null,
|
||||
"updated_at": Any<String>,
|
||||
"value": "123",
|
||||
},
|
||||
Object {
|
||||
"created_at": Any<String>,
|
||||
"deleted_at": null,
|
||||
"id": Any<String>,
|
||||
"metadata": null,
|
||||
"updated_at": Any<String>,
|
||||
"value": "456",
|
||||
},
|
||||
],
|
||||
"thumbnail": "test-image.png",
|
||||
"title": "Test",
|
||||
"type": Object {
|
||||
"created_at": Any<String>,
|
||||
"deleted_at": null,
|
||||
"id": "test-type",
|
||||
"metadata": null,
|
||||
"updated_at": Any<String>,
|
||||
"value": "test-type",
|
||||
},
|
||||
"type_id": "test-type",
|
||||
"updated_at": Any<String>,
|
||||
"variants": Array [
|
||||
Object {
|
||||
"allow_backorder": false,
|
||||
"barcode": null,
|
||||
"created_at": Any<String>,
|
||||
"deleted_at": null,
|
||||
"ean": null,
|
||||
"height": null,
|
||||
"hs_code": null,
|
||||
"id": StringMatching /\\^variant_\\*/,
|
||||
"inventory_quantity": 10,
|
||||
"length": null,
|
||||
"manage_inventory": true,
|
||||
"material": null,
|
||||
"metadata": null,
|
||||
"mid_code": null,
|
||||
"options": Array [
|
||||
Object {
|
||||
"created_at": Any<String>,
|
||||
"deleted_at": null,
|
||||
"id": StringMatching /\\^optval_\\*/,
|
||||
"metadata": null,
|
||||
"option_id": StringMatching /\\^opt_\\*/,
|
||||
"updated_at": Any<String>,
|
||||
"value": "large",
|
||||
"variant_id": StringMatching /\\^variant_\\*/,
|
||||
},
|
||||
Object {
|
||||
"created_at": Any<String>,
|
||||
"deleted_at": null,
|
||||
"id": StringMatching /\\^optval_\\*/,
|
||||
"metadata": null,
|
||||
"option_id": StringMatching /\\^opt_\\*/,
|
||||
"updated_at": Any<String>,
|
||||
"value": "green",
|
||||
"variant_id": StringMatching /\\^variant_\\*/,
|
||||
},
|
||||
],
|
||||
"origin_country": null,
|
||||
"prices": Array [
|
||||
Object {
|
||||
"amount": 100,
|
||||
"created_at": Any<String>,
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": StringMatching /\\^ma_\\*/,
|
||||
"max_quantity": null,
|
||||
"min_quantity": null,
|
||||
"price_list_id": null,
|
||||
"region_id": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": StringMatching /\\^variant_\\*/,
|
||||
},
|
||||
Object {
|
||||
"amount": 45,
|
||||
"created_at": Any<String>,
|
||||
"currency_code": "eur",
|
||||
"deleted_at": null,
|
||||
"id": StringMatching /\\^ma_\\*/,
|
||||
"max_quantity": null,
|
||||
"min_quantity": null,
|
||||
"price_list_id": null,
|
||||
"region_id": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": StringMatching /\\^variant_\\*/,
|
||||
},
|
||||
Object {
|
||||
"amount": 30,
|
||||
"created_at": Any<String>,
|
||||
"currency_code": "dkk",
|
||||
"deleted_at": null,
|
||||
"id": StringMatching /\\^ma_\\*/,
|
||||
"max_quantity": null,
|
||||
"min_quantity": null,
|
||||
"price_list_id": null,
|
||||
"region_id": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": StringMatching /\\^variant_\\*/,
|
||||
},
|
||||
],
|
||||
"product_id": StringMatching /\\^prod_\\*/,
|
||||
"sku": null,
|
||||
"title": "Test variant",
|
||||
"upc": null,
|
||||
"updated_at": Any<String>,
|
||||
"weight": null,
|
||||
"width": null,
|
||||
},
|
||||
],
|
||||
"weight": null,
|
||||
"width": null,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`/admin/products POST /admin/products updates a product (update prices, tags, update status, delete collection, delete type, replaces images) 1`] = `
|
||||
Object {
|
||||
"collection": null,
|
||||
"collection_id": null,
|
||||
"created_at": Any<String>,
|
||||
"deleted_at": null,
|
||||
"description": "test-product-description",
|
||||
"discountable": true,
|
||||
"external_id": null,
|
||||
"handle": "test-product",
|
||||
"height": null,
|
||||
"hs_code": null,
|
||||
"id": "test-product",
|
||||
"images": Array [
|
||||
Object {
|
||||
"created_at": Any<String>,
|
||||
"deleted_at": null,
|
||||
"id": StringMatching /\\^img_\\*/,
|
||||
"metadata": null,
|
||||
"updated_at": Any<String>,
|
||||
"url": "test-image-2.png",
|
||||
},
|
||||
],
|
||||
"is_giftcard": false,
|
||||
"length": null,
|
||||
"material": null,
|
||||
"metadata": null,
|
||||
"mid_code": null,
|
||||
"options": Array [
|
||||
Object {
|
||||
"created_at": Any<String>,
|
||||
"deleted_at": null,
|
||||
"id": "test-option",
|
||||
"metadata": null,
|
||||
"product_id": "test-product",
|
||||
"title": "test-option",
|
||||
"updated_at": Any<String>,
|
||||
},
|
||||
],
|
||||
"origin_country": null,
|
||||
"profile_id": StringMatching /\\^sp_\\*/,
|
||||
"status": "published",
|
||||
"subtitle": null,
|
||||
"tags": Array [
|
||||
Object {
|
||||
"created_at": Any<String>,
|
||||
"deleted_at": null,
|
||||
"id": "tag1",
|
||||
"metadata": null,
|
||||
"updated_at": Any<String>,
|
||||
"value": "123",
|
||||
},
|
||||
],
|
||||
"thumbnail": "test-image-2.png",
|
||||
"title": "Test product",
|
||||
"type": Object {
|
||||
"created_at": Any<String>,
|
||||
"deleted_at": null,
|
||||
"id": StringMatching /\\^ptyp_\\*/,
|
||||
"metadata": null,
|
||||
"updated_at": Any<String>,
|
||||
"value": "test-type-2",
|
||||
},
|
||||
"type_id": StringMatching /\\^ptyp_\\*/,
|
||||
"updated_at": Any<String>,
|
||||
"variants": Array [
|
||||
Object {
|
||||
"allow_backorder": false,
|
||||
"barcode": "test-barcode",
|
||||
"created_at": Any<String>,
|
||||
"deleted_at": null,
|
||||
"ean": "test-ean",
|
||||
"height": null,
|
||||
"hs_code": null,
|
||||
"id": "test-variant",
|
||||
"inventory_quantity": 10,
|
||||
"length": null,
|
||||
"manage_inventory": true,
|
||||
"material": null,
|
||||
"metadata": null,
|
||||
"mid_code": null,
|
||||
"options": Array [
|
||||
Object {
|
||||
"created_at": Any<String>,
|
||||
"deleted_at": null,
|
||||
"id": "test-variant-option",
|
||||
"metadata": null,
|
||||
"option_id": "test-option",
|
||||
"updated_at": Any<String>,
|
||||
"value": "Default variant",
|
||||
"variant_id": "test-variant",
|
||||
},
|
||||
],
|
||||
"origin_country": null,
|
||||
"prices": Array [
|
||||
Object {
|
||||
"amount": 75,
|
||||
"created_at": Any<String>,
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": "test-price",
|
||||
"max_quantity": null,
|
||||
"min_quantity": null,
|
||||
"price_list_id": null,
|
||||
"region_id": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": "test-variant",
|
||||
},
|
||||
],
|
||||
"product_id": "test-product",
|
||||
"sku": "test-sku",
|
||||
"title": "Test variant",
|
||||
"upc": "test-upc",
|
||||
"updated_at": Any<String>,
|
||||
"weight": null,
|
||||
"width": null,
|
||||
},
|
||||
],
|
||||
"weight": null,
|
||||
"width": null,
|
||||
}
|
||||
`;
|
||||
|
||||
758
integration-tests/api/__tests__/admin/price-list.js
Normal file
758
integration-tests/api/__tests__/admin/price-list.js
Normal file
@@ -0,0 +1,758 @@
|
||||
const path = require("path")
|
||||
|
||||
const setupServer = require("../../../helpers/setup-server")
|
||||
const { useApi } = require("../../../helpers/use-api")
|
||||
const { useDb, initDb } = require("../../../helpers/use-db")
|
||||
|
||||
const adminSeeder = require("../../helpers/admin-seeder")
|
||||
const customerSeeder = require("../../helpers/customer-seeder")
|
||||
const priceListSeeder = require("../../helpers/price-list-seeder")
|
||||
const productSeeder = require("../../helpers/product-seeder")
|
||||
|
||||
jest.setTimeout(30000)
|
||||
|
||||
describe("/admin/price-lists", () => {
|
||||
let medusaProcess
|
||||
let dbConnection
|
||||
|
||||
beforeAll(async () => {
|
||||
const cwd = path.resolve(path.join(__dirname, "..", ".."))
|
||||
dbConnection = await initDb({ cwd })
|
||||
medusaProcess = await setupServer({ cwd })
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
const db = useDb()
|
||||
await db.shutdown()
|
||||
medusaProcess.kill()
|
||||
})
|
||||
|
||||
describe("POST /admin/price-list", () => {
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await adminSeeder(dbConnection)
|
||||
await customerSeeder(dbConnection)
|
||||
await productSeeder(dbConnection)
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
throw err
|
||||
}
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
const db = useDb()
|
||||
await db.teardown()
|
||||
})
|
||||
|
||||
it("creates a price list", async () => {
|
||||
const api = useApi()
|
||||
|
||||
const payload = {
|
||||
name: "VIP Summer sale",
|
||||
description: "Summer sale for VIP customers. 25% off selected items.",
|
||||
type: "sale",
|
||||
status: "active",
|
||||
starts_at: "2022-07-01T00:00:00.000Z",
|
||||
ends_at: "2022-07-31T00:00:00.000Z",
|
||||
customer_groups: [
|
||||
{
|
||||
id: "customer-group-1",
|
||||
},
|
||||
],
|
||||
prices: [
|
||||
{
|
||||
amount: 85,
|
||||
currency_code: "usd",
|
||||
variant_id: "test-variant",
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
const response = await api
|
||||
.post("/admin/price-lists", payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
console.warn(err.response.data)
|
||||
})
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.price_list).toEqual(
|
||||
expect.objectContaining({
|
||||
id: expect.any(String),
|
||||
name: "VIP Summer sale",
|
||||
description: "Summer sale for VIP customers. 25% off selected items.",
|
||||
type: "sale",
|
||||
status: "active",
|
||||
starts_at: "2022-07-01T00:00:00.000Z",
|
||||
ends_at: "2022-07-31T00:00:00.000Z",
|
||||
customer_groups: [
|
||||
expect.objectContaining({
|
||||
id: "customer-group-1",
|
||||
}),
|
||||
],
|
||||
prices: [
|
||||
expect.objectContaining({
|
||||
id: expect.any(String),
|
||||
amount: 85,
|
||||
currency_code: "usd",
|
||||
variant_id: "test-variant",
|
||||
}),
|
||||
],
|
||||
})
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe("GET /admin/price-lists", () => {
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await adminSeeder(dbConnection)
|
||||
await productSeeder(dbConnection)
|
||||
await priceListSeeder(dbConnection)
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
throw err
|
||||
}
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
const db = useDb()
|
||||
await db.teardown()
|
||||
})
|
||||
|
||||
it("returns a price list by :id", async () => {
|
||||
const api = useApi()
|
||||
|
||||
const response = await api
|
||||
.get("/admin/price-lists/pl_no_customer_groups", {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
console.warn(err.response.data)
|
||||
})
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.price_list).toMatchSnapshot({
|
||||
id: expect.any(String),
|
||||
name: "VIP winter sale",
|
||||
description: "Winter sale for VIP customers. 25% off selected items.",
|
||||
type: "sale",
|
||||
status: "active",
|
||||
starts_at: "2022-07-01T00:00:00.000Z",
|
||||
ends_at: "2022-07-31T00:00:00.000Z",
|
||||
prices: [
|
||||
{
|
||||
id: expect.any(String),
|
||||
amount: 100,
|
||||
currency_code: "usd",
|
||||
min_quantity: 1,
|
||||
max_quantity: 100,
|
||||
variant_id: "test-variant",
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
{
|
||||
id: expect.any(String),
|
||||
amount: 80,
|
||||
currency_code: "usd",
|
||||
min_quantity: 101,
|
||||
max_quantity: 500,
|
||||
variant_id: "test-variant",
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
{
|
||||
id: expect.any(String),
|
||||
amount: 50,
|
||||
currency_code: "usd",
|
||||
min_quantity: 501,
|
||||
max_quantity: 1000,
|
||||
variant_id: "test-variant",
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
],
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
})
|
||||
})
|
||||
|
||||
it("returns a list of price lists", async () => {
|
||||
const api = useApi()
|
||||
|
||||
const response = await api
|
||||
.get("/admin/price-lists", {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
console.warn(err.response.data)
|
||||
})
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.price_lists).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: "pl_no_customer_groups",
|
||||
}),
|
||||
])
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe("POST /admin/price-lists/:id", () => {
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await adminSeeder(dbConnection)
|
||||
await customerSeeder(dbConnection)
|
||||
await productSeeder(dbConnection)
|
||||
await priceListSeeder(dbConnection)
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
throw err
|
||||
}
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
const db = useDb()
|
||||
await db.teardown()
|
||||
})
|
||||
|
||||
it("updates a price list", async () => {
|
||||
const api = useApi()
|
||||
|
||||
const payload = {
|
||||
name: "Loyalty Reward - Winter Sale",
|
||||
description: "Winter sale for our most loyal customers",
|
||||
type: "sale",
|
||||
status: "draft",
|
||||
starts_at: "2022-09-01T00:00:00.000Z",
|
||||
ends_at: "2022-12-31T00:00:00.000Z",
|
||||
customer_groups: [
|
||||
{
|
||||
id: "customer-group-1",
|
||||
},
|
||||
],
|
||||
prices: [
|
||||
{
|
||||
amount: 85,
|
||||
currency_code: "usd",
|
||||
variant_id: "test-variant_1",
|
||||
},
|
||||
{
|
||||
amount: 10,
|
||||
currency_code: "usd",
|
||||
variant_id: "test-variant",
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
const response = await api
|
||||
.post("/admin/price-lists/pl_no_customer_groups", payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
console.warn(err.response.data)
|
||||
})
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.price_list).toMatchSnapshot({
|
||||
id: "pl_no_customer_groups",
|
||||
name: "Loyalty Reward - Winter Sale",
|
||||
description: "Winter sale for our most loyal customers",
|
||||
type: "sale",
|
||||
status: "draft",
|
||||
starts_at: "2022-09-01T00:00:00.000Z",
|
||||
ends_at: "2022-12-31T00:00:00.000Z",
|
||||
prices: [
|
||||
{
|
||||
id: expect.any(String),
|
||||
amount: 100,
|
||||
currency_code: "usd",
|
||||
min_quantity: 1,
|
||||
max_quantity: 100,
|
||||
variant_id: "test-variant",
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
region_id: null,
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
{
|
||||
id: expect.any(String),
|
||||
amount: 80,
|
||||
currency_code: "usd",
|
||||
min_quantity: 101,
|
||||
max_quantity: 500,
|
||||
variant_id: "test-variant",
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
region_id: null,
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
{
|
||||
id: expect.any(String),
|
||||
amount: 50,
|
||||
currency_code: "usd",
|
||||
min_quantity: 501,
|
||||
max_quantity: 1000,
|
||||
variant_id: "test-variant",
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
region_id: null,
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
{
|
||||
id: expect.any(String),
|
||||
amount: 85,
|
||||
currency_code: "usd",
|
||||
variant_id: "test-variant_1",
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
min_quantity: null,
|
||||
max_quantity: null,
|
||||
region_id: null,
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
deleted_at: null,
|
||||
},
|
||||
{
|
||||
id: expect.any(String),
|
||||
amount: 10,
|
||||
currency_code: "usd",
|
||||
variant_id: "test-variant",
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
min_quantity: null,
|
||||
max_quantity: null,
|
||||
region_id: null,
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
deleted_at: null,
|
||||
},
|
||||
],
|
||||
customer_groups: [
|
||||
{
|
||||
id: "customer-group-1",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
],
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
})
|
||||
})
|
||||
|
||||
it("updates the amount and currency of a price in the price list", async () => {
|
||||
const api = useApi()
|
||||
|
||||
const payload = {
|
||||
prices: [
|
||||
{
|
||||
id: "ma_test_1",
|
||||
amount: 250,
|
||||
currency_code: "eur",
|
||||
variant_id: "test-variant",
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
const response = await api
|
||||
.post("/admin/price-lists/pl_no_customer_groups", payload, {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
console.warn(err.response.data)
|
||||
})
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
|
||||
const updatedPrice = response.data.price_list.prices.find(
|
||||
(p) => p.id === "ma_test_1"
|
||||
)
|
||||
|
||||
expect(updatedPrice).toMatchSnapshot({
|
||||
id: "ma_test_1",
|
||||
amount: 250,
|
||||
currency_code: "eur",
|
||||
min_quantity: 1,
|
||||
max_quantity: 100,
|
||||
variant_id: "test-variant",
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
region_id: null,
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe("POST /admin/price-lists/:id/prices/batch", () => {
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await adminSeeder(dbConnection)
|
||||
await productSeeder(dbConnection)
|
||||
await priceListSeeder(dbConnection)
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
throw err
|
||||
}
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
const db = useDb()
|
||||
await db.teardown()
|
||||
})
|
||||
|
||||
it("Adds a batch of new prices to a price list without overriding existing prices", async () => {
|
||||
const api = useApi()
|
||||
|
||||
const payload = {
|
||||
prices: [
|
||||
{
|
||||
amount: 45,
|
||||
currency_code: "usd",
|
||||
variant_id: "test-variant",
|
||||
min_quantity: 1001,
|
||||
max_quantity: 2000,
|
||||
},
|
||||
{
|
||||
amount: 35,
|
||||
currency_code: "usd",
|
||||
variant_id: "test-variant",
|
||||
min_quantity: 2001,
|
||||
max_quantity: 3000,
|
||||
},
|
||||
{
|
||||
amount: 25,
|
||||
currency_code: "usd",
|
||||
variant_id: "test-variant",
|
||||
min_quantity: 3001,
|
||||
max_quantity: 4000,
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
const response = await api
|
||||
.post(
|
||||
"/admin/price-lists/pl_no_customer_groups/prices/batch",
|
||||
payload,
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
.catch((err) => {
|
||||
console.warn(err.response.data)
|
||||
})
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.price_list.prices.length).toEqual(6)
|
||||
expect(response.data.price_list.prices).toMatchSnapshot([
|
||||
{
|
||||
id: expect.any(String),
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
amount: 100,
|
||||
currency_code: "usd",
|
||||
min_quantity: 1,
|
||||
max_quantity: 100,
|
||||
variant_id: "test-variant",
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
{
|
||||
id: expect.any(String),
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
amount: 80,
|
||||
currency_code: "usd",
|
||||
min_quantity: 101,
|
||||
max_quantity: 500,
|
||||
variant_id: "test-variant",
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
{
|
||||
id: expect.any(String),
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
amount: 50,
|
||||
currency_code: "usd",
|
||||
min_quantity: 501,
|
||||
max_quantity: 1000,
|
||||
variant_id: "test-variant",
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
{
|
||||
id: expect.any(String),
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
amount: 45,
|
||||
currency_code: "usd",
|
||||
variant_id: "test-variant",
|
||||
min_quantity: 1001,
|
||||
max_quantity: 2000,
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
{
|
||||
id: expect.any(String),
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
amount: 35,
|
||||
currency_code: "usd",
|
||||
variant_id: "test-variant",
|
||||
min_quantity: 2001,
|
||||
max_quantity: 3000,
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
{
|
||||
id: expect.any(String),
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
amount: 25,
|
||||
currency_code: "usd",
|
||||
variant_id: "test-variant",
|
||||
min_quantity: 3001,
|
||||
max_quantity: 4000,
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
])
|
||||
})
|
||||
|
||||
it("Adds a batch of new prices to a price list overriding existing prices", async () => {
|
||||
const api = useApi()
|
||||
|
||||
const payload = {
|
||||
prices: [
|
||||
{
|
||||
amount: 45,
|
||||
currency_code: "usd",
|
||||
variant_id: "test-variant",
|
||||
min_quantity: 1001,
|
||||
max_quantity: 2000,
|
||||
},
|
||||
{
|
||||
amount: 35,
|
||||
currency_code: "usd",
|
||||
variant_id: "test-variant",
|
||||
min_quantity: 2001,
|
||||
max_quantity: 3000,
|
||||
},
|
||||
{
|
||||
amount: 25,
|
||||
currency_code: "usd",
|
||||
variant_id: "test-variant",
|
||||
min_quantity: 3001,
|
||||
max_quantity: 4000,
|
||||
},
|
||||
],
|
||||
override: true,
|
||||
}
|
||||
|
||||
const response = await api
|
||||
.post(
|
||||
"/admin/price-lists/pl_no_customer_groups/prices/batch",
|
||||
payload,
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
.catch((err) => {
|
||||
console.warn(err.response.data)
|
||||
})
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.price_list.prices.length).toEqual(3)
|
||||
expect(response.data.price_list.prices).toMatchSnapshot([
|
||||
{
|
||||
id: expect.any(String),
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
amount: 45,
|
||||
currency_code: "usd",
|
||||
variant_id: "test-variant",
|
||||
min_quantity: 1001,
|
||||
max_quantity: 2000,
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
{
|
||||
id: expect.any(String),
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
amount: 35,
|
||||
currency_code: "usd",
|
||||
variant_id: "test-variant",
|
||||
min_quantity: 2001,
|
||||
max_quantity: 3000,
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
{
|
||||
id: expect.any(String),
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
amount: 25,
|
||||
currency_code: "usd",
|
||||
variant_id: "test-variant",
|
||||
min_quantity: 3001,
|
||||
max_quantity: 4000,
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
])
|
||||
})
|
||||
})
|
||||
|
||||
describe("DELETE /admin/price-lists/:id", () => {
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await adminSeeder(dbConnection)
|
||||
await productSeeder(dbConnection)
|
||||
await priceListSeeder(dbConnection)
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
throw err
|
||||
}
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
const db = useDb()
|
||||
await db.teardown()
|
||||
})
|
||||
|
||||
it("Deletes a price list", async () => {
|
||||
const api = useApi()
|
||||
|
||||
const response = await api
|
||||
.delete("/admin/price-lists/pl_no_customer_groups", {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
console.warn(err.response.data)
|
||||
})
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data).toEqual({
|
||||
id: "pl_no_customer_groups",
|
||||
object: "price-list",
|
||||
deleted: true,
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe("tests cascade on delete", () => {
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await adminSeeder(dbConnection)
|
||||
await productSeeder(dbConnection)
|
||||
await priceListSeeder(dbConnection)
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
throw err
|
||||
}
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
const db = useDb()
|
||||
await db.teardown()
|
||||
})
|
||||
|
||||
it("Deletes a variant and ensures that prices associated with the variant are deleted from PriceList", async () => {
|
||||
const api = useApi()
|
||||
|
||||
const deleteResponse = await api
|
||||
.delete("/admin/products/test-product/variants/test-variant", {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
console.warn(err.response.data)
|
||||
})
|
||||
|
||||
|
||||
const response = await api.get(
|
||||
"/admin/price-lists/pl_no_customer_groups",
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.price_list.prices.length).toEqual(0)
|
||||
})
|
||||
})
|
||||
|
||||
describe("DELETE /admin/price-lists/:id/prices/batch", () => {
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await adminSeeder(dbConnection)
|
||||
await productSeeder(dbConnection)
|
||||
await priceListSeeder(dbConnection)
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
throw err
|
||||
}
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
const db = useDb()
|
||||
await db.teardown()
|
||||
})
|
||||
|
||||
it("Deletes several prices associated with a price list", async () => {
|
||||
const api = useApi()
|
||||
|
||||
const response = await api
|
||||
.delete("/admin/price-lists/pl_no_customer_groups/prices/batch", {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
},
|
||||
data: {
|
||||
price_ids: ["ma_test_1", "ma_test_2"],
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
console.warn(err.response.data)
|
||||
})
|
||||
|
||||
const getPriceListResponse = await api
|
||||
.get("/admin/price-lists/pl_no_customer_groups", {
|
||||
headers: {
|
||||
Authorization: "Bearer test_token",
|
||||
},
|
||||
})
|
||||
.catch((err) => {
|
||||
console.warn(err.response.data)
|
||||
})
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data).toEqual({
|
||||
ids: ["ma_test_1", "ma_test_2"],
|
||||
object: "money-amount",
|
||||
deleted: true,
|
||||
})
|
||||
expect(getPriceListResponse.data.price_list.prices.length).toEqual(1)
|
||||
expect(getPriceListResponse.data.price_list.prices[0].id).toEqual(
|
||||
"ma_test_3"
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -7,6 +7,7 @@ const { initDb, useDb } = require("../../../helpers/use-db")
|
||||
const adminSeeder = require("../../helpers/admin-seeder")
|
||||
const productSeeder = require("../../helpers/product-seeder")
|
||||
const { ProductVariant } = require("@medusajs/medusa")
|
||||
const priceListSeeder = require("../../helpers/price-list-seeder")
|
||||
|
||||
jest.setTimeout(50000)
|
||||
|
||||
@@ -773,7 +774,20 @@ describe("/admin/products", () => {
|
||||
{
|
||||
title: "Test variant",
|
||||
inventory_quantity: 10,
|
||||
prices: [{ currency_code: "usd", amount: 100 }],
|
||||
prices: [
|
||||
{
|
||||
currency_code: "usd",
|
||||
amount: 100,
|
||||
},
|
||||
{
|
||||
currency_code: "eur",
|
||||
amount: 45,
|
||||
},
|
||||
{
|
||||
currency_code: "dkk",
|
||||
amount: 30,
|
||||
},
|
||||
],
|
||||
options: [{ value: "large" }, { value: "green" }],
|
||||
},
|
||||
],
|
||||
@@ -790,66 +804,126 @@ describe("/admin/products", () => {
|
||||
})
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
expect(response.data.product).toEqual(
|
||||
expect.objectContaining({
|
||||
title: "Test",
|
||||
discountable: true,
|
||||
is_giftcard: false,
|
||||
handle: "test",
|
||||
status: "draft",
|
||||
images: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
url: "test-image.png",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
url: "test-image-2.png",
|
||||
}),
|
||||
]),
|
||||
thumbnail: "test-image.png",
|
||||
tags: [
|
||||
expect.objectContaining({
|
||||
value: "123",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
value: "456",
|
||||
}),
|
||||
],
|
||||
type: expect.objectContaining({
|
||||
value: "test-type",
|
||||
}),
|
||||
collection: expect.objectContaining({
|
||||
id: "test-collection",
|
||||
title: "Test collection",
|
||||
}),
|
||||
options: [
|
||||
expect.objectContaining({
|
||||
title: "size",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
title: "color",
|
||||
}),
|
||||
],
|
||||
variants: [
|
||||
expect.objectContaining({
|
||||
title: "Test variant",
|
||||
prices: [
|
||||
expect.objectContaining({
|
||||
currency_code: "usd",
|
||||
amount: 100,
|
||||
}),
|
||||
],
|
||||
options: [
|
||||
expect.objectContaining({
|
||||
value: "large",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
value: "green",
|
||||
}),
|
||||
],
|
||||
}),
|
||||
],
|
||||
})
|
||||
)
|
||||
expect(response.data.product).toMatchSnapshot({
|
||||
id: expect.stringMatching(/^prod_*/),
|
||||
title: "Test",
|
||||
discountable: true,
|
||||
is_giftcard: false,
|
||||
handle: "test",
|
||||
status: "draft",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
profile_id: expect.stringMatching(/^sp_*/),
|
||||
images: [
|
||||
{
|
||||
id: expect.any(String),
|
||||
url: "test-image.png",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
{
|
||||
id: expect.any(String),
|
||||
url: "test-image-2.png",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
],
|
||||
thumbnail: "test-image.png",
|
||||
tags: [
|
||||
{
|
||||
id: expect.any(String),
|
||||
value: "123",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
{
|
||||
id: expect.any(String),
|
||||
value: "456",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
],
|
||||
type: {
|
||||
value: "test-type",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
collection: {
|
||||
id: "test-collection",
|
||||
title: "Test collection",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
options: [
|
||||
{
|
||||
id: expect.stringMatching(/^opt_*/),
|
||||
product_id: expect.stringMatching(/^prod_*/),
|
||||
title: "size",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
{
|
||||
id: expect.stringMatching(/^opt_*/),
|
||||
product_id: expect.stringMatching(/^prod_*/),
|
||||
title: "color",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
],
|
||||
variants: [
|
||||
{
|
||||
id: expect.stringMatching(/^variant_*/),
|
||||
product_id: expect.stringMatching(/^prod_*/),
|
||||
updated_at: expect.any(String),
|
||||
created_at: expect.any(String),
|
||||
title: "Test variant",
|
||||
prices: [
|
||||
{
|
||||
id: expect.stringMatching(/^ma_*/),
|
||||
currency_code: "usd",
|
||||
amount: 100,
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
variant_id: expect.stringMatching(/^variant_*/),
|
||||
},
|
||||
{
|
||||
id: expect.stringMatching(/^ma_*/),
|
||||
currency_code: "eur",
|
||||
amount: 45,
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
variant_id: expect.stringMatching(/^variant_*/),
|
||||
},
|
||||
{
|
||||
id: expect.stringMatching(/^ma_*/),
|
||||
currency_code: "dkk",
|
||||
amount: 30,
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
variant_id: expect.stringMatching(/^variant_*/),
|
||||
},
|
||||
],
|
||||
options: [
|
||||
{
|
||||
value: "large",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
variant_id: expect.stringMatching(/^variant_*/),
|
||||
option_id: expect.stringMatching(/^opt_*/),
|
||||
id: expect.stringMatching(/^optval_*/),
|
||||
},
|
||||
{
|
||||
value: "green",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
variant_id: expect.stringMatching(/^variant_*/),
|
||||
option_id: expect.stringMatching(/^opt_*/),
|
||||
id: expect.stringMatching(/^optval_*/),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
})
|
||||
})
|
||||
|
||||
it("creates a product that is not discountable", async () => {
|
||||
@@ -1006,8 +1080,7 @@ describe("/admin/products", () => {
|
||||
prices: [
|
||||
{
|
||||
currency_code: "usd",
|
||||
amount: 100,
|
||||
sale_amount: 75,
|
||||
amount: 75,
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -1030,36 +1103,92 @@ describe("/admin/products", () => {
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
|
||||
expect(response.data.product).toEqual(
|
||||
expect.objectContaining({
|
||||
images: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
url: "test-image-2.png",
|
||||
}),
|
||||
]),
|
||||
thumbnail: "test-image-2.png",
|
||||
tags: [
|
||||
expect.objectContaining({
|
||||
value: "123",
|
||||
}),
|
||||
],
|
||||
variants: [
|
||||
expect.objectContaining({
|
||||
prices: [
|
||||
expect.objectContaining({
|
||||
sale_amount: 75,
|
||||
amount: 100,
|
||||
}),
|
||||
],
|
||||
}),
|
||||
],
|
||||
status: "published",
|
||||
collection: null,
|
||||
type: expect.objectContaining({
|
||||
value: "test-type-2",
|
||||
}),
|
||||
})
|
||||
)
|
||||
expect(response.data.product).toMatchSnapshot({
|
||||
id: "test-product",
|
||||
created_at: expect.any(String),
|
||||
description: "test-product-description",
|
||||
discountable: true,
|
||||
handle: "test-product",
|
||||
images: [
|
||||
{
|
||||
created_at: expect.any(String),
|
||||
deleted_at: null,
|
||||
id: expect.stringMatching(/^img_*/),
|
||||
metadata: null,
|
||||
updated_at: expect.any(String),
|
||||
url: "test-image-2.png",
|
||||
},
|
||||
],
|
||||
is_giftcard: false,
|
||||
options: [
|
||||
{
|
||||
created_at: expect.any(String),
|
||||
id: "test-option",
|
||||
product_id: "test-product",
|
||||
title: "test-option",
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
],
|
||||
profile_id: expect.stringMatching(/^sp_*/),
|
||||
status: "published",
|
||||
tags: [
|
||||
{
|
||||
created_at: expect.any(String),
|
||||
id: "tag1",
|
||||
updated_at: expect.any(String),
|
||||
value: "123",
|
||||
},
|
||||
],
|
||||
thumbnail: "test-image-2.png",
|
||||
title: "Test product",
|
||||
type: {
|
||||
created_at: expect.any(String),
|
||||
id: expect.stringMatching(/^ptyp_*/),
|
||||
updated_at: expect.any(String),
|
||||
value: "test-type-2",
|
||||
},
|
||||
type_id: expect.stringMatching(/^ptyp_*/),
|
||||
updated_at: expect.any(String),
|
||||
variants: [
|
||||
{
|
||||
allow_backorder: false,
|
||||
barcode: "test-barcode",
|
||||
created_at: expect.any(String),
|
||||
ean: "test-ean",
|
||||
id: "test-variant",
|
||||
inventory_quantity: 10,
|
||||
manage_inventory: true,
|
||||
options: [
|
||||
{
|
||||
created_at: expect.any(String),
|
||||
deleted_at: null,
|
||||
id: "test-variant-option",
|
||||
metadata: null,
|
||||
option_id: "test-option",
|
||||
updated_at: expect.any(String),
|
||||
value: "Default variant",
|
||||
variant_id: "test-variant",
|
||||
},
|
||||
],
|
||||
origin_country: null,
|
||||
prices: [
|
||||
{
|
||||
amount: 75,
|
||||
created_at: expect.any(String),
|
||||
currency_code: "usd",
|
||||
id: "test-price",
|
||||
updated_at: expect.any(String),
|
||||
variant_id: "test-variant",
|
||||
},
|
||||
],
|
||||
product_id: "test-product",
|
||||
sku: "test-sku",
|
||||
title: "Test variant",
|
||||
upc: "test-upc",
|
||||
updated_at: expect.any(String),
|
||||
},
|
||||
],
|
||||
})
|
||||
})
|
||||
|
||||
it("updates product (removes images when empty array included)", async () => {
|
||||
@@ -1189,11 +1318,12 @@ describe("/admin/products", () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("updates a variant's prices", () => {
|
||||
describe("updates a variant's default prices (ignores prices associated with a Price List)", () => {
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await productSeeder(dbConnection)
|
||||
await adminSeeder(dbConnection)
|
||||
await priceListSeeder(dbConnection)
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
throw err
|
||||
@@ -1205,7 +1335,7 @@ describe("/admin/products", () => {
|
||||
await db.teardown()
|
||||
})
|
||||
|
||||
it("successfully updates a variant's prices by changing an existing price (currency_code)", async () => {
|
||||
it("successfully updates a variant's default prices by changing an existing price (currency_code)", async () => {
|
||||
const api = useApi()
|
||||
const data = {
|
||||
prices: [
|
||||
@@ -1239,6 +1369,33 @@ describe("/admin/products", () => {
|
||||
amount: 1500,
|
||||
currency_code: "usd",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: "ma_test_1",
|
||||
amount: 100,
|
||||
currency_code: "usd",
|
||||
min_quantity: 1,
|
||||
max_quantity: 100,
|
||||
variant_id: "test-variant",
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: "ma_test_2",
|
||||
amount: 80,
|
||||
currency_code: "usd",
|
||||
min_quantity: 101,
|
||||
max_quantity: 500,
|
||||
variant_id: "test-variant",
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: "ma_test_3",
|
||||
amount: 50,
|
||||
currency_code: "usd",
|
||||
min_quantity: 501,
|
||||
max_quantity: 1000,
|
||||
variant_id: "test-variant",
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
]),
|
||||
@@ -1316,26 +1473,55 @@ describe("/admin/products", () => {
|
||||
|
||||
expect(response.status).toEqual(200)
|
||||
|
||||
expect(response.data).toEqual({
|
||||
product: expect.objectContaining({
|
||||
id: "test-product",
|
||||
variants: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: "test-variant",
|
||||
prices: [
|
||||
expect.objectContaining({
|
||||
amount: 100,
|
||||
currency_code: "usd",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
amount: 4500,
|
||||
currency_code: "eur",
|
||||
}),
|
||||
],
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
})
|
||||
expect(response.data).toEqual(
|
||||
expect.objectContaining({
|
||||
product: expect.objectContaining({
|
||||
id: "test-product",
|
||||
variants: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: "test-variant",
|
||||
prices: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
amount: 100,
|
||||
currency_code: "usd",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
amount: 4500,
|
||||
currency_code: "eur",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: "ma_test_1",
|
||||
amount: 100,
|
||||
currency_code: "usd",
|
||||
min_quantity: 1,
|
||||
max_quantity: 100,
|
||||
variant_id: "test-variant",
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: "ma_test_2",
|
||||
amount: 80,
|
||||
currency_code: "usd",
|
||||
min_quantity: 101,
|
||||
max_quantity: 500,
|
||||
variant_id: "test-variant",
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: "ma_test_3",
|
||||
amount: 50,
|
||||
currency_code: "usd",
|
||||
min_quantity: 501,
|
||||
max_quantity: 1000,
|
||||
variant_id: "test-variant",
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
it("successfully updates a variant's prices by replacing a price", async () => {
|
||||
@@ -1343,7 +1529,7 @@ describe("/admin/products", () => {
|
||||
const data = {
|
||||
prices: [
|
||||
{
|
||||
currency_code: "eur",
|
||||
currency_code: "usd",
|
||||
amount: 4500,
|
||||
},
|
||||
],
|
||||
@@ -1362,14 +1548,43 @@ describe("/admin/products", () => {
|
||||
expect(response.status).toEqual(200)
|
||||
|
||||
expect(response.data.product.variants[0].prices.length).toEqual(
|
||||
data.prices.length
|
||||
4 // 3 prices from Price List + 1 default price
|
||||
)
|
||||
expect(response.data.product.variants[0].prices).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
amount: 4500,
|
||||
currency_code: "usd",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: "ma_test_1",
|
||||
amount: 100,
|
||||
currency_code: "usd",
|
||||
min_quantity: 1,
|
||||
max_quantity: 100,
|
||||
variant_id: "test-variant",
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: "ma_test_2",
|
||||
amount: 80,
|
||||
currency_code: "usd",
|
||||
min_quantity: 101,
|
||||
max_quantity: 500,
|
||||
variant_id: "test-variant",
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: "ma_test_3",
|
||||
amount: 50,
|
||||
currency_code: "usd",
|
||||
min_quantity: 501,
|
||||
max_quantity: 1000,
|
||||
variant_id: "test-variant",
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
}),
|
||||
])
|
||||
)
|
||||
expect(response.data.product.variants[0].prices).toEqual([
|
||||
expect.objectContaining({
|
||||
amount: 4500,
|
||||
currency_code: "eur",
|
||||
}),
|
||||
])
|
||||
})
|
||||
|
||||
it("successfully updates a variant's prices by deleting a price and adding another price", async () => {
|
||||
@@ -1400,18 +1615,47 @@ describe("/admin/products", () => {
|
||||
expect(response.status).toEqual(200)
|
||||
|
||||
expect(response.data.product.variants[0].prices.length).toEqual(
|
||||
data.prices.length
|
||||
5 // 2 default prices + 3 prices from Price List
|
||||
)
|
||||
expect(response.data.product.variants[0].prices).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
amount: 8000,
|
||||
currency_code: "dkk",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
amount: 900,
|
||||
currency_code: "eur",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: "ma_test_1",
|
||||
amount: 100,
|
||||
currency_code: "usd",
|
||||
min_quantity: 1,
|
||||
max_quantity: 100,
|
||||
variant_id: "test-variant",
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: "ma_test_2",
|
||||
amount: 80,
|
||||
currency_code: "usd",
|
||||
min_quantity: 101,
|
||||
max_quantity: 500,
|
||||
variant_id: "test-variant",
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: "ma_test_3",
|
||||
amount: 50,
|
||||
currency_code: "usd",
|
||||
min_quantity: 501,
|
||||
max_quantity: 1000,
|
||||
variant_id: "test-variant",
|
||||
price_list_id: "pl_no_customer_groups",
|
||||
}),
|
||||
])
|
||||
)
|
||||
expect(response.data.product.variants[0].prices).toEqual([
|
||||
expect.objectContaining({
|
||||
amount: 8000,
|
||||
currency_code: "dkk",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
amount: 900,
|
||||
currency_code: "eur",
|
||||
}),
|
||||
])
|
||||
})
|
||||
|
||||
it("successfully updates a variant's prices by updating an existing price (using region_id) and adding another price", async () => {
|
||||
|
||||
@@ -32,8 +32,8 @@ describe("/admin/store", () => {
|
||||
|
||||
afterEach(async () => {
|
||||
const db = useDb()
|
||||
db.teardown()
|
||||
medusaProcess.kill()
|
||||
await db.teardown()
|
||||
await medusaProcess.kill()
|
||||
})
|
||||
|
||||
it("has created store with default currency", async () => {
|
||||
|
||||
@@ -37,8 +37,10 @@ Object {
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": "test-price",
|
||||
"max_quantity": null,
|
||||
"min_quantity": null,
|
||||
"price_list_id": null,
|
||||
"region_id": null,
|
||||
"sale_amount": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": "test-variant",
|
||||
},
|
||||
@@ -93,8 +95,10 @@ Object {
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": "test-price",
|
||||
"max_quantity": null,
|
||||
"min_quantity": null,
|
||||
"price_list_id": null,
|
||||
"region_id": null,
|
||||
"sale_amount": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": "test-variant",
|
||||
},
|
||||
@@ -150,8 +154,10 @@ Object {
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": Any<String>,
|
||||
"max_quantity": null,
|
||||
"min_quantity": null,
|
||||
"price_list_id": null,
|
||||
"region_id": null,
|
||||
"sale_amount": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": Any<String>,
|
||||
},
|
||||
|
||||
@@ -162,8 +162,10 @@ Object {
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": "test-price",
|
||||
"max_quantity": null,
|
||||
"min_quantity": null,
|
||||
"price_list_id": null,
|
||||
"region_id": null,
|
||||
"sale_amount": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": "test-variant",
|
||||
},
|
||||
@@ -211,8 +213,10 @@ Object {
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": "test-price2",
|
||||
"max_quantity": null,
|
||||
"min_quantity": null,
|
||||
"price_list_id": null,
|
||||
"region_id": null,
|
||||
"sale_amount": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": "test-variant_2",
|
||||
},
|
||||
@@ -260,8 +264,10 @@ Object {
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": "test-price1",
|
||||
"max_quantity": null,
|
||||
"min_quantity": null,
|
||||
"price_list_id": null,
|
||||
"region_id": null,
|
||||
"sale_amount": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": "test-variant_1",
|
||||
},
|
||||
@@ -314,8 +320,10 @@ Object {
|
||||
"currency_code": "usd",
|
||||
"deleted_at": null,
|
||||
"id": Any<String>,
|
||||
"max_quantity": null,
|
||||
"min_quantity": null,
|
||||
"price_list_id": null,
|
||||
"region_id": null,
|
||||
"sale_amount": null,
|
||||
"updated_at": Any<String>,
|
||||
"variant_id": Any<String>,
|
||||
},
|
||||
|
||||
@@ -99,7 +99,9 @@ describe("/store/variants", () => {
|
||||
deleted_at: null,
|
||||
id: "test-price",
|
||||
region_id: null,
|
||||
sale_amount: null,
|
||||
min_quantity: null,
|
||||
max_quantity: null,
|
||||
price_list_id: null,
|
||||
variant_id: "test-variant",
|
||||
},
|
||||
],
|
||||
@@ -193,7 +195,9 @@ describe("/store/variants", () => {
|
||||
deleted_at: null,
|
||||
id: "test-price",
|
||||
region_id: null,
|
||||
sale_amount: null,
|
||||
min_quantity: null,
|
||||
max_quantity: null,
|
||||
price_list_id: null,
|
||||
variant_id: "test-variant",
|
||||
},
|
||||
],
|
||||
|
||||
@@ -353,7 +353,9 @@ describe("/store/products", () => {
|
||||
deleted_at: null,
|
||||
id: "test-price",
|
||||
region_id: null,
|
||||
sale_amount: null,
|
||||
min_quantity: null,
|
||||
max_quantity: null,
|
||||
price_list_id: null,
|
||||
updated_at: expect.any(String),
|
||||
variant_id: "test-variant",
|
||||
},
|
||||
@@ -396,7 +398,9 @@ describe("/store/products", () => {
|
||||
deleted_at: null,
|
||||
id: "test-price2",
|
||||
region_id: null,
|
||||
sale_amount: null,
|
||||
min_quantity: null,
|
||||
max_quantity: null,
|
||||
price_list_id: null,
|
||||
variant_id: "test-variant_2",
|
||||
},
|
||||
],
|
||||
@@ -438,7 +442,9 @@ describe("/store/products", () => {
|
||||
deleted_at: null,
|
||||
id: "test-price1",
|
||||
region_id: null,
|
||||
sale_amount: null,
|
||||
min_quantity: null,
|
||||
max_quantity: null,
|
||||
price_list_id: null,
|
||||
updated_at: expect.any(String),
|
||||
variant_id: "test-variant_1",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user