feat(medusa, admin-ui): add description field to product categories (#3768)
* feat(medusa): add description field to product categories * chore: set nullable to false * chore: added UI for description * chore: added codegen files
This commit is contained in:
@@ -437,6 +437,27 @@ describe("/admin/product-categories", () => {
|
||||
)
|
||||
})
|
||||
|
||||
it("throws an error when description is not a string", async () => {
|
||||
const api = useApi()
|
||||
const payload = {
|
||||
name: "test",
|
||||
handle: "test",
|
||||
description: null
|
||||
}
|
||||
|
||||
const error = await api.post(
|
||||
`/admin/product-categories`,
|
||||
payload,
|
||||
adminHeaders
|
||||
).catch(e => e)
|
||||
|
||||
expect(error.response.status).toEqual(400)
|
||||
expect(error.response.data.type).toEqual("invalid_data")
|
||||
expect(error.response.data.message).toEqual(
|
||||
"description must be a string"
|
||||
)
|
||||
})
|
||||
|
||||
it("successfully creates a product category", async () => {
|
||||
const api = useApi()
|
||||
const payload = {
|
||||
@@ -444,6 +465,7 @@ describe("/admin/product-categories", () => {
|
||||
handle: "test",
|
||||
is_internal: true,
|
||||
parent_category_id: productCategory.id,
|
||||
description: "test"
|
||||
}
|
||||
|
||||
const response = await api.post(
|
||||
@@ -457,6 +479,7 @@ describe("/admin/product-categories", () => {
|
||||
expect.objectContaining({
|
||||
product_category: expect.objectContaining({
|
||||
name: payload.name,
|
||||
description: payload.description,
|
||||
handle: payload.handle,
|
||||
is_internal: payload.is_internal,
|
||||
is_active: false,
|
||||
|
||||
Reference in New Issue
Block a user