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:
@@ -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)
|
||||
})
|
||||
|
||||
@@ -202,9 +202,6 @@ describe("/store/variants", () => {
|
||||
},
|
||||
],
|
||||
product: expect.any(Object),
|
||||
options: [
|
||||
{ created_at: expect.any(String), updated_at: expect.any(String) },
|
||||
],
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
@@ -344,11 +344,9 @@ describe("/store/products", () => {
|
||||
],
|
||||
prices: [
|
||||
{
|
||||
id: "test-money-amount",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
amount: 100,
|
||||
created_at: expect.any(String),
|
||||
currency_code: "usd",
|
||||
deleted_at: null,
|
||||
id: "test-price",
|
||||
@@ -356,7 +354,6 @@ describe("/store/products", () => {
|
||||
min_quantity: null,
|
||||
max_quantity: null,
|
||||
price_list_id: null,
|
||||
updated_at: expect.any(String),
|
||||
variant_id: "test-variant",
|
||||
},
|
||||
],
|
||||
@@ -389,11 +386,9 @@ describe("/store/products", () => {
|
||||
],
|
||||
prices: [
|
||||
{
|
||||
id: "test-money-amount",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
amount: 100,
|
||||
created_at: expect.any(String),
|
||||
currency_code: "usd",
|
||||
deleted_at: null,
|
||||
id: "test-price2",
|
||||
@@ -433,11 +428,9 @@ describe("/store/products", () => {
|
||||
],
|
||||
prices: [
|
||||
{
|
||||
id: "test-money-amount",
|
||||
created_at: expect.any(String),
|
||||
updated_at: expect.any(String),
|
||||
amount: 100,
|
||||
created_at: expect.any(String),
|
||||
currency_code: "usd",
|
||||
deleted_at: null,
|
||||
id: "test-price1",
|
||||
@@ -445,7 +438,6 @@ describe("/store/products", () => {
|
||||
min_quantity: null,
|
||||
max_quantity: null,
|
||||
price_list_id: null,
|
||||
updated_at: expect.any(String),
|
||||
variant_id: "test-variant_1",
|
||||
},
|
||||
],
|
||||
@@ -548,7 +540,7 @@ describe("/store/products", () => {
|
||||
it("lists all published products", async () => {
|
||||
const api = useApi()
|
||||
|
||||
//update test-product status to published
|
||||
// update test-product status to published
|
||||
await api
|
||||
.post(
|
||||
"/admin/products/test-product",
|
||||
|
||||
@@ -40,16 +40,19 @@ module.exports = async (connection, data = {}) => {
|
||||
id: "test-customer-5",
|
||||
email: "test5@email.com",
|
||||
})
|
||||
await manager.save(customer5)
|
||||
|
||||
const customer6 = await manager.create(Customer, {
|
||||
id: "test-customer-6",
|
||||
email: "test6@email.com",
|
||||
})
|
||||
await manager.save(customer6)
|
||||
|
||||
const customer7 = await manager.create(Customer, {
|
||||
id: "test-customer-7",
|
||||
email: "test7@email.com",
|
||||
})
|
||||
await manager.save(customer7)
|
||||
|
||||
const deletionCustomer = await manager.create(Customer, {
|
||||
id: "test-customer-delete-cg",
|
||||
|
||||
Reference in New Issue
Block a user