Skip to content

Commit

Permalink
Merge branch 'medusajs:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
sensei-woo authored Dec 22, 2024
2 parents d1d2fa4 + f7aaf2c commit 04ff098
Show file tree
Hide file tree
Showing 324 changed files with 4,270 additions and 2,611 deletions.
9 changes: 0 additions & 9 deletions .changeset/gorgeous-tools-enjoy.md

This file was deleted.

6 changes: 6 additions & 0 deletions .changeset/grumpy-ladybugs-tickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@medusajs/icons": patch
"@medusajs/ui": patch
---

chore(ui,icons): Add React 19/19-rc to peer dependencies
5 changes: 0 additions & 5 deletions .changeset/heavy-spies-thank.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/little-books-think.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/pink-ways-count.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/wet-queens-deliver.md

This file was deleted.

28 changes: 28 additions & 0 deletions integration-tests/http/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# integration-tests-http

## 1.0.6

### Patch Changes

- Updated dependencies [[`100da64242838739816351ed259461f2d7c258e3`](https://github.com/medusajs/medusa/commit/100da64242838739816351ed259461f2d7c258e3), [`d08b71f9b87c68350e57016e62e406a9bdd82342`](https://github.com/medusajs/medusa/commit/d08b71f9b87c68350e57016e62e406a9bdd82342), [`c9b8db04c1b35f1cf129bb9ad74789fbc2881815`](https://github.com/medusajs/medusa/commit/c9b8db04c1b35f1cf129bb9ad74789fbc2881815), [`9d85e663b8bac2240ec3e3bf99377dd0eac72160`](https://github.com/medusajs/medusa/commit/9d85e663b8bac2240ec3e3bf99377dd0eac72160), [`5d1098ceb9713225186fce16c0306b0539d71fc5`](https://github.com/medusajs/medusa/commit/5d1098ceb9713225186fce16c0306b0539d71fc5), [`1232a43fcec50b01477149089bbb957dec15ba76`](https://github.com/medusajs/medusa/commit/1232a43fcec50b01477149089bbb957dec15ba76)]:
- @medusajs/fulfillment@2.1.3
- @medusajs/utils@2.1.3
- @medusajs/medusa@2.1.3
- @medusajs/product@2.1.3
- @medusajs/core-flows@2.1.3
- @medusajs/modules-sdk@2.1.3
- @medusajs/test-utils@2.1.3
- @medusajs/api-key@2.1.3
- @medusajs/auth@2.1.3
- @medusajs/cache-inmemory@2.1.3
- @medusajs/customer@2.1.3
- @medusajs/event-bus-local@2.1.3
- @medusajs/inventory@2.1.3
- @medusajs/pricing@2.1.3
- @medusajs/promotion@2.1.3
- @medusajs/fulfillment-manual@2.1.3
- @medusajs/region@2.1.3
- @medusajs/stock-location@2.1.3
- @medusajs/store@2.1.3
- @medusajs/tax@2.1.3
- @medusajs/user@2.1.3
- @medusajs/workflow-engine-inmemory@2.1.3

## 1.0.5

### Patch Changes
Expand Down
131 changes: 106 additions & 25 deletions integration-tests/http/__tests__/cart/store/cart.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ medusaIntegrationTestRunner({
})

describe("POST /store/carts/:id/line-items", () => {
let shippingOption
let shippingOption, shippingOptionExpensive

beforeEach(async () => {
const stockLocation = (
Expand Down Expand Up @@ -358,25 +358,63 @@ medusaIntegrationTestRunner({
adminHeaders
)

const shippingOptionPayload = {
name: `Shipping`,
service_zone_id: fulfillmentSet.service_zones[0].id,
shipping_profile_id: shippingProfile.id,
provider_id: "manual_test-provider",
price_type: "flat",
type: {
label: "Test type",
description: "Test description",
code: "test-code",
},
prices: [
{ currency_code: "usd", amount: 1000 },
{
currency_code: "usd",
amount: 0,
rules: [
{
attribute: "item_total",
operator: "gt",
value: 5000,
},
],
},
],
rules: [
{
attribute: "enabled_in_store",
value: '"true"',
operator: "eq",
},
{
attribute: "is_return",
value: "false",
operator: "eq",
},
],
}

shippingOption = (
await api.post(
`/admin/shipping-options`,
shippingOptionPayload,
adminHeaders
)
).data.shipping_option

shippingOptionExpensive = (
await api.post(
`/admin/shipping-options`,
{
name: `Shipping`,
service_zone_id: fulfillmentSet.service_zones[0].id,
shipping_profile_id: shippingProfile.id,
provider_id: "manual_test-provider",
price_type: "flat",
type: {
label: "Test type",
description: "Test description",
code: "test-code",
},
...shippingOptionPayload,
prices: [
{ currency_code: "usd", amount: 1000 },
{ currency_code: "usd", amount: 10000 },
{
currency_code: "usd",
amount: 0,
amount: 5000,
rules: [
{
attribute: "item_total",
Expand All @@ -386,18 +424,6 @@ medusaIntegrationTestRunner({
],
},
],
rules: [
{
attribute: "enabled_in_store",
value: '"true"',
operator: "eq",
},
{
attribute: "is_return",
value: "false",
operator: "eq",
},
],
},
adminHeaders
)
Expand Down Expand Up @@ -555,6 +581,61 @@ medusaIntegrationTestRunner({
})
)
})

it("should update payment collection upon changing shipping option", async () => {
await api.post(
`/store/carts/${cart.id}/shipping-methods`,
{ option_id: shippingOption.id },
storeHeaders
)

await api.post(
`/store/payment-collections`,
{ cart_id: cart.id },
storeHeaders
)

const cartAfterCollection = (
await api.get(`/store/carts/${cart.id}`, storeHeaders)
).data.cart

expect(cartAfterCollection).toEqual(
expect.objectContaining({
id: cart.id,
shipping_methods: expect.arrayContaining([
expect.objectContaining({
shipping_option_id: shippingOption.id,
}),
]),
payment_collection: expect.objectContaining({
amount: 2398,
}),
})
)

let cartAfterExpensiveShipping = (
await api.post(
`/store/carts/${cart.id}/shipping-methods`,
{ option_id: shippingOptionExpensive.id },
storeHeaders
)
).data.cart

expect(cartAfterExpensiveShipping).toEqual(
expect.objectContaining({
id: cartAfterExpensiveShipping.id,
shipping_methods: expect.arrayContaining([
expect.objectContaining({
shipping_option_id: shippingOptionExpensive.id,
amount: 5000,
}),
]),
payment_collection: expect.objectContaining({
amount: 6398,
}),
})
)
})
})

it("should add item to cart with tax lines multiple times", async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
import {
createAdminUser,
adminHeaders,
createAdminUser,
} from "../../../../helpers/create-admin-user"

jest.setTimeout(30000)
Expand Down Expand Up @@ -216,9 +216,7 @@ medusaIntegrationTestRunner({
it("adds products to collection", async () => {
const response = await api.post(
`/admin/collections/${baseCollection.id}/products?fields=*products`,
{
add: [baseProduct.id, baseProduct1.id],
},
{ add: [baseProduct.id, baseProduct1.id] },
adminHeaders
)

Expand All @@ -242,6 +240,54 @@ medusaIntegrationTestRunner({
)
})

it("should not remove products from collection when updating collection", async () => {
const addProductsResponse = await api.post(
`/admin/collections/${baseCollection.id}/products?fields=*products`,
{ add: [baseProduct.id, baseProduct1.id] },
adminHeaders
)

expect(addProductsResponse.status).toEqual(200)
expect(addProductsResponse.data.collection).toEqual(
expect.objectContaining({
id: baseCollection.id,
products: expect.arrayContaining([
expect.objectContaining({
collection_id: baseCollection.id,
title: "test-product",
}),
expect.objectContaining({
collection_id: baseCollection.id,
title: "test-product1",
}),
]),
})
)

const updateCollectionResponse = await api.post(
`/admin/collections/${baseCollection.id}?fields=*products`,
{ title: "test collection update" },
adminHeaders
)

expect(updateCollectionResponse.status).toEqual(200)
expect(updateCollectionResponse.data.collection).toEqual(
expect.objectContaining({
title: "test collection update",
products: expect.arrayContaining([
expect.objectContaining({
collection_id: baseCollection.id,
title: "test-product",
}),
expect.objectContaining({
collection_id: baseCollection.id,
title: "test-product1",
}),
]),
})
)
})

it("removes products from collection", async () => {
await api.post(
`/admin/collections/${baseCollection.id}/products`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,10 @@ medusaIntegrationTestRunner({
},
]),
provider_id: "manual_test-provider",
provider: {
provider: expect.objectContaining({
id: "manual_test-provider",
is_enabled: true,
},
}),
rules: [],
service_zone_id: expect.any(String),
service_zone: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ medusaIntegrationTestRunner({

expect(response.status).toEqual(200)
expect(response.data.stock_location.fulfillment_providers).toEqual([
{ id: "manual_test-provider", is_enabled: true },
expect.objectContaining({
id: "manual_test-provider",
is_enabled: true,
}),
])
})

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/http/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "integration-tests-http",
"version": "1.0.5",
"version": "1.0.6",
"main": "index.js",
"license": "MIT",
"private": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2116,6 +2116,7 @@ medusaIntegrationTestRunner({
])

let cart = await cartModuleService.createCarts({
sales_channel_id: salesChannel.id,
currency_code: "usd",
items: [
{
Expand Down
Loading

0 comments on commit 04ff098

Please sign in to comment.