Feat(admin-next, core-flows, link-modules, medusa, types): Inventory end to end flows (#7020)
* add reservation endpoints * add changeset * initial * add reservations table * add edit-item modal * udpate inventory item attributes * manage locations skeleton * add combi batch endpoint * cleanup * fix manage locations * add adjust inventory * prep for pr * update versions * fix for pr * fix for pr * cleanup * Update packages/core-flows/src/inventory/workflows/bulk-create-delete-levels.ts Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com> * Update packages/core-flows/src/inventory/steps/delete-levels-by-item-and-location.ts Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com> * rm wack import * fix build --------- Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
This commit is contained in:
co-authored by
Carlos R. L. Rodrigues
parent
276278cbe7
commit
ab7ff64c4a
@@ -1,9 +1,9 @@
|
||||
import { IInventoryServiceNext, IStockLocationService } from "@medusajs/types"
|
||||
|
||||
import {
|
||||
ContainerRegistrationKeys,
|
||||
remoteQueryObjectFromString,
|
||||
} from "@medusajs/utils"
|
||||
import { IInventoryServiceNext, IStockLocationService } from "@medusajs/types"
|
||||
|
||||
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
|
||||
import { createAdminUser } from "../../../helpers/create-admin-user"
|
||||
|
||||
@@ -314,6 +314,49 @@ medusaIntegrationTestRunner({
|
||||
})
|
||||
})
|
||||
|
||||
describe("Bulk create/delete inventory levels", () => {
|
||||
const locationId = "loc_1"
|
||||
let inventoryItem
|
||||
|
||||
beforeEach(async () => {
|
||||
inventoryItem = await service.create({
|
||||
sku: "MY_SKU",
|
||||
})
|
||||
|
||||
await service.createInventoryLevels([
|
||||
{
|
||||
inventory_item_id: inventoryItem.id,
|
||||
location_id: locationId,
|
||||
stocked_quantity: 10,
|
||||
},
|
||||
])
|
||||
})
|
||||
|
||||
it("should delete an inventory location level and create a new one", async () => {
|
||||
const result = await api.post(
|
||||
`/admin/inventory-items/${inventoryItem.id}/location-levels/batch/combi`,
|
||||
{
|
||||
creates: [
|
||||
{
|
||||
location_id: "location_2",
|
||||
},
|
||||
],
|
||||
deletes: [locationId],
|
||||
},
|
||||
adminHeaders
|
||||
)
|
||||
|
||||
expect(result.status).toEqual(200)
|
||||
|
||||
const levelsListResult = await api.get(
|
||||
`/admin/inventory-items/${inventoryItem.id}/location-levels`,
|
||||
adminHeaders
|
||||
)
|
||||
expect(levelsListResult.status).toEqual(200)
|
||||
expect(levelsListResult.data.inventory_levels).toHaveLength(1)
|
||||
})
|
||||
})
|
||||
|
||||
describe("Delete inventory levels", () => {
|
||||
const locationId = "loc_1"
|
||||
let inventoryItem
|
||||
|
||||
Reference in New Issue
Block a user