feat(medusa): Separate money amount and variant (#4906)
* initial changes * working test * final changes to product tests * update integration tests * update price list integration tests * update integration tests * update unit tests * update plugin integration tests * remove catch from integration test * undo change * add andWhere * update upsertCurrencyMoneyAmount method * undo line item changes * undo changes * update deprecated method * Update packages/medusa/src/migrations/1692953518123-drop_money_amount_constraints_for_pricing_module.ts Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com> * rename joinTable * update with joinTable entity * update load methods * remove await create * re-add context test * update price list behavior for prices * update price list snapshots * re-add admin seeder * pr feedback * fix unit tests * fix plugin integration tests * initial review changes * redo changes to variant creation --------- Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com> Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
@@ -32,6 +32,7 @@ const {
|
||||
const {
|
||||
simpleCustomerGroupFactory,
|
||||
} = require("../../../../factories/simple-customer-group-factory")
|
||||
const { ProductVariantMoneyAmount } = require("@medusajs/medusa")
|
||||
|
||||
jest.setTimeout(30000)
|
||||
|
||||
@@ -144,7 +145,6 @@ describe("/store/carts", () => {
|
||||
await dbConnection.manager.save(priceList1)
|
||||
|
||||
const ma_sale_1 = dbConnection.manager.create(MoneyAmount, {
|
||||
variant_id: prodSale.variants[0].id,
|
||||
currency_code: "usd",
|
||||
amount: 800,
|
||||
price_list_id: "pl_current",
|
||||
@@ -152,6 +152,12 @@ describe("/store/carts", () => {
|
||||
|
||||
await dbConnection.manager.save(ma_sale_1)
|
||||
|
||||
await dbConnection.manager.insert(ProductVariantMoneyAmount, {
|
||||
id: `${prodSale.variants[0].id}-${ma_sale_1.id}`,
|
||||
variant_id: prodSale.variants[0].id,
|
||||
money_amount_id: ma_sale_1.id,
|
||||
})
|
||||
|
||||
const api = useApi()
|
||||
|
||||
const response = await api
|
||||
@@ -2289,7 +2295,7 @@ describe("/store/carts", () => {
|
||||
await cartSeeder(dbConnection)
|
||||
const manager = dbConnection.manager
|
||||
|
||||
const _cart = await manager.create(Cart, {
|
||||
const _cart = manager.create(Cart, {
|
||||
id: "test-cart-with-cso",
|
||||
customer_id: "some-customer",
|
||||
email: "some-customer@email.com",
|
||||
|
||||
Reference in New Issue
Block a user