Feat: Price selection implementation (#1158)

* init

* added buld id validation to repo

* admin done

* updated price reqs

* initial price selection strategy

* update customer seeder

* format models

* price selection strategy

* price selection testing

* update price selection tests

* update price selection strategy

* remove console.warn

* update price selection strat

* remove console.log

* fix unit tests

* update product snapshot integration tests

* fix failing unit tests

* update variant test snapshots

* 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

* price selection strategy methods

* fix integration tests

* update unit tests

* update jsdoc

* update price selection strategy parameter

* fix unit tests

* pr feedback

Co-authored-by: Kasper <kasper@medusajs.com>
Co-authored-by: Kasper Fabricius Kristensen <45367945+kasperkristensen@users.noreply.github.com>
This commit is contained in:
Philip Korsholm
2022-03-21 19:03:42 +01:00
committed by GitHub
parent 5300926db8
commit dfa3502e41
10 changed files with 701 additions and 58 deletions

View File

@@ -467,7 +467,6 @@ describe("/admin/price-lists", () => {
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),
},
@@ -479,7 +478,6 @@ describe("/admin/price-lists", () => {
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),
},
@@ -491,7 +489,6 @@ describe("/admin/price-lists", () => {
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),
},
@@ -674,7 +671,7 @@ describe("/admin/price-lists", () => {
it("Deletes a variant and ensures that prices associated with the variant are deleted from PriceList", async () => {
const api = useApi()
const deleteResponse = await api
await api
.delete("/admin/products/test-product/variants/test-variant", {
headers: {
Authorization: "Bearer test_token",
@@ -684,7 +681,6 @@ describe("/admin/price-lists", () => {
console.warn(err.response.data)
})
const response = await api.get(
"/admin/price-lists/pl_no_customer_groups",
{
@@ -694,7 +690,6 @@ describe("/admin/price-lists", () => {
}
)
expect(response.status).toEqual(200)
expect(response.data.price_list.prices.length).toEqual(0)
})