feat(core-flows, fulfillment): validate shipping options to stock locations (#8291)

what:

- validate shipping options to stock locations

RESOLVES CC-232
This commit is contained in:
Riqwan Thamir
2024-07-26 12:26:26 +00:00
committed by GitHub
parent 74d0d166b3
commit 91c17651f1
23 changed files with 607 additions and 18 deletions
@@ -16,6 +16,7 @@ import {
import {
ContainerRegistrationKeys,
ModuleRegistrationName,
Modules,
RuleOperator,
remoteQueryObjectFromString,
} from "@medusajs/utils"
@@ -151,6 +152,37 @@ medusaIntegrationTestRunner({
},
],
})
const stockLocationModule = container.resolve(
ModuleRegistrationName.STOCK_LOCATION
)
const location = await stockLocationModule.createStockLocations({
name: "Europe",
})
const remoteLink = container.resolve(
ContainerRegistrationKeys.REMOTE_LINK
)
await remoteLink.create([
{
[Modules.STOCK_LOCATION]: {
stock_location_id: location.id,
},
[Modules.FULFILLMENT]: {
fulfillment_set_id: fulfillmentSet.id,
},
},
{
[Modules.STOCK_LOCATION]: {
stock_location_id: location.id,
},
[Modules.FULFILLMENT]: {
fulfillment_provider_id: "manual_test-provider",
},
},
])
})
it("should create, update and delete rules in batch", async () => {
@@ -10,6 +10,7 @@ import {
import {
ContainerRegistrationKeys,
ModuleRegistrationName,
Modules,
RuleOperator,
remoteQueryObjectFromString,
} from "@medusajs/utils"
@@ -57,6 +58,37 @@ medusaIntegrationTestRunner({
},
],
})
const stockLocationModule = container.resolve(
ModuleRegistrationName.STOCK_LOCATION
)
const location = await stockLocationModule.createStockLocations({
name: "Europe",
})
const remoteLink = container.resolve(
ContainerRegistrationKeys.REMOTE_LINK
)
await remoteLink.create([
{
[Modules.STOCK_LOCATION]: {
stock_location_id: location.id,
},
[Modules.FULFILLMENT]: {
fulfillment_set_id: fulfillmentSet.id,
},
},
{
[Modules.STOCK_LOCATION]: {
stock_location_id: location.id,
},
[Modules.FULFILLMENT]: {
fulfillment_provider_id: "manual_test-provider",
},
},
])
})
it("should create shipping options and prices", async () => {
@@ -13,6 +13,7 @@ import {
import {
ContainerRegistrationKeys,
ModuleRegistrationName,
Modules,
RuleOperator,
remoteQueryObjectFromString,
} from "@medusajs/utils"
@@ -60,6 +61,37 @@ medusaIntegrationTestRunner({
},
],
})
const stockLocationModule = container.resolve(
ModuleRegistrationName.STOCK_LOCATION
)
const location = await stockLocationModule.createStockLocations({
name: "Europe",
})
const remoteLink = container.resolve(
ContainerRegistrationKeys.REMOTE_LINK
)
await remoteLink.create([
{
[Modules.STOCK_LOCATION]: {
stock_location_id: location.id,
},
[Modules.FULFILLMENT]: {
fulfillment_set_id: fulfillmentSet.id,
},
},
{
[Modules.STOCK_LOCATION]: {
stock_location_id: location.id,
},
[Modules.FULFILLMENT]: {
fulfillment_provider_id: "manual_test-provider",
},
},
])
})
it("should delete shipping options", async () => {
@@ -14,6 +14,7 @@ import {
import {
ContainerRegistrationKeys,
ModuleRegistrationName,
Modules,
RuleOperator,
remoteQueryObjectFromString,
} from "@medusajs/utils"
@@ -61,6 +62,37 @@ medusaIntegrationTestRunner({
},
],
})
const stockLocationModule = container.resolve(
ModuleRegistrationName.STOCK_LOCATION
)
const location = await stockLocationModule.createStockLocations({
name: "Europe",
})
const remoteLink = container.resolve(
ContainerRegistrationKeys.REMOTE_LINK
)
await remoteLink.create([
{
[Modules.STOCK_LOCATION]: {
stock_location_id: location.id,
},
[Modules.FULFILLMENT]: {
fulfillment_set_id: fulfillmentSet.id,
},
},
{
[Modules.STOCK_LOCATION]: {
stock_location_id: location.id,
},
[Modules.FULFILLMENT]: {
fulfillment_provider_id: "manual_test-provider",
},
},
])
})
it("should update shipping options", async () => {