fix: Accept filters in softDelete + fulfillment location clean-up (#7198)
This commit is contained in:
@@ -245,6 +245,14 @@ medusaIntegrationTestRunner({
|
||||
object: "stock_location",
|
||||
deleted: true,
|
||||
})
|
||||
|
||||
const stockLocations = await api.get(
|
||||
`/admin/stock-locations`,
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
expect(stockLocations.status).toEqual(200)
|
||||
expect(stockLocations.data.stock_locations).toEqual([])
|
||||
})
|
||||
|
||||
it("should successfully delete stock location associations", async () => {
|
||||
@@ -390,7 +398,7 @@ medusaIntegrationTestRunner({
|
||||
stockLocationId = createResponse.data.stock_location.id
|
||||
})
|
||||
|
||||
it("should create a fulfillment set for the location", async () => {
|
||||
it("should create a fulfillment set for the location and then delete it and its associations", async () => {
|
||||
const response = await api.post(
|
||||
`/admin/stock-locations/${stockLocationId}/fulfillment-sets?fields=id,*fulfillment_sets`,
|
||||
{
|
||||
@@ -407,6 +415,19 @@ medusaIntegrationTestRunner({
|
||||
id: expect.any(String),
|
||||
}),
|
||||
])
|
||||
|
||||
await api.delete(
|
||||
`/admin/stock-locations/${stockLocationId}`,
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
const fulfillmentModule = appContainer.resolve(
|
||||
ModuleRegistrationName.FULFILLMENT
|
||||
)
|
||||
|
||||
const sets = await fulfillmentModule.list()
|
||||
|
||||
expect(sets).toHaveLength(0)
|
||||
})
|
||||
|
||||
// This is really just to test the new Zod middleware. We don't need more of these.
|
||||
|
||||
@@ -1634,12 +1634,12 @@ medusaIntegrationTestRunner({
|
||||
},
|
||||
},
|
||||
{
|
||||
[Modules.FULFILLMENT]: {
|
||||
fulfillment_set_id: fulfillmentSet.id,
|
||||
},
|
||||
[Modules.STOCK_LOCATION]: {
|
||||
stock_location_id: location.id,
|
||||
},
|
||||
[Modules.FULFILLMENT]: {
|
||||
fulfillment_set_id: fulfillmentSet.id,
|
||||
},
|
||||
},
|
||||
{
|
||||
[Modules.FULFILLMENT]: {
|
||||
@@ -1745,12 +1745,12 @@ medusaIntegrationTestRunner({
|
||||
|
||||
await remoteLink.create([
|
||||
{
|
||||
[Modules.FULFILLMENT]: {
|
||||
fulfillment_set_id: fulfillmentSet.id,
|
||||
},
|
||||
[Modules.STOCK_LOCATION]: {
|
||||
stock_location_id: location.id,
|
||||
},
|
||||
[Modules.FULFILLMENT]: {
|
||||
fulfillment_set_id: fulfillmentSet.id,
|
||||
},
|
||||
},
|
||||
{
|
||||
[Modules.FULFILLMENT]: {
|
||||
@@ -1849,12 +1849,12 @@ medusaIntegrationTestRunner({
|
||||
},
|
||||
},
|
||||
{
|
||||
[Modules.FULFILLMENT]: {
|
||||
fulfillment_set_id: fulfillmentSet.id,
|
||||
},
|
||||
[Modules.STOCK_LOCATION]: {
|
||||
stock_location_id: location.id,
|
||||
},
|
||||
[Modules.FULFILLMENT]: {
|
||||
fulfillment_set_id: fulfillmentSet.id,
|
||||
},
|
||||
},
|
||||
])
|
||||
|
||||
|
||||
@@ -1485,8 +1485,8 @@ medusaIntegrationTestRunner({
|
||||
|
||||
await remoteLinkService.create([
|
||||
{
|
||||
[Modules.FULFILLMENT]: { fulfillment_set_id: fulfillmentSet.id },
|
||||
[Modules.STOCK_LOCATION]: { stock_location_id: stockLocation.id },
|
||||
[Modules.FULFILLMENT]: { fulfillment_set_id: fulfillmentSet.id },
|
||||
},
|
||||
])
|
||||
|
||||
|
||||
@@ -52,18 +52,18 @@ medusaIntegrationTestRunner({
|
||||
|
||||
await remoteLink.create([
|
||||
{
|
||||
[Modules.FULFILLMENT]: {
|
||||
fulfillment_set_id: fulfillmentSet.id,
|
||||
},
|
||||
[Modules.STOCK_LOCATION]: {
|
||||
stock_location_id: euWarehouse.id,
|
||||
},
|
||||
[Modules.FULFILLMENT]: {
|
||||
fulfillment_set_id: fulfillmentSet.id,
|
||||
},
|
||||
},
|
||||
])
|
||||
|
||||
const linkQuery = remoteQueryObjectFromString({
|
||||
entryPoint: "fulfillment_sets",
|
||||
fields: ["id", "stock_locations.id"],
|
||||
entryPoint: "stock_locations",
|
||||
fields: ["id", "fulfillment_sets.id"],
|
||||
})
|
||||
|
||||
const link = await remoteQuery(linkQuery)
|
||||
@@ -72,10 +72,10 @@ medusaIntegrationTestRunner({
|
||||
expect(link).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: fulfillmentSet.id,
|
||||
stock_locations: expect.arrayContaining([
|
||||
id: euWarehouse.id,
|
||||
fulfillment_sets: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: euWarehouse.id,
|
||||
id: fulfillmentSet.id,
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
|
||||
@@ -127,12 +127,12 @@ medusaIntegrationTestRunner({
|
||||
|
||||
await remoteLinkService.create([
|
||||
{
|
||||
[Modules.FULFILLMENT]: {
|
||||
fulfillment_set_id: fulfillmentSet.id,
|
||||
},
|
||||
[Modules.STOCK_LOCATION]: {
|
||||
stock_location_id: stockLocation.id,
|
||||
},
|
||||
[Modules.FULFILLMENT]: {
|
||||
fulfillment_set_id: fulfillmentSet.id,
|
||||
},
|
||||
},
|
||||
])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user