feat(medusa, core-flows): add retrieve stock location endpoint to api-v2 (#6791)

* initial create

* add changeset

* redo changes for stock locatino module'

* add get endpoint

* add changeset

* add exception if location is not found

* remove only

* initial delete stock location

* add changeset

* add changeset

* pr prep

* remote duplicate changeset

* propagate deletion with common step

* move integration tests

---------

Co-authored-by: Riqwan Thamir <rmthamir@gmail.com>
This commit is contained in:
Philip Korsholm
2024-03-25 16:58:23 +01:00
committed by GitHub
parent deab12e27e
commit 20132d7cea
5 changed files with 89 additions and 0 deletions

View File

@@ -56,6 +56,47 @@ medusaIntegrationTestRunner({
})
})
describe("Get stock location", () => {
let locationId
const location = {
name: "Test Location",
}
beforeEach(async () => {
const createLocationRespones = await api.post(
"/admin/stock-locations",
{
...location,
},
adminHeaders
)
locationId = createLocationRespones.data.stock_location.id
})
it("should get a stock location", async () => {
const response = await api.get(
`/admin/stock-locations/${locationId}`,
adminHeaders
)
expect(response.status).toEqual(200)
expect(response.data.stock_location).toEqual(
expect.objectContaining({ id: locationId, ...location })
)
})
it("should get a stock location", async () => {
let error
await api
.get(`/admin/stock-locations/does-not-exist`, adminHeaders)
.catch((e) => (error = e))
expect(error.response.status).toEqual(404)
expect(error.response.data.message).toEqual(
`Stock location with id: does-not-exist was not found`
)
})
})
describe("Delete stock location", () => {
let stockLocationId
beforeEach(async () => {