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:
+32
@@ -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 () => {
|
||||
|
||||
+32
@@ -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 () => {
|
||||
|
||||
+32
@@ -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 () => {
|
||||
|
||||
+32
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user